trisgutt <trisgutt <at> hotmail.com> writes:
>
> I am currently using a GLM with Gaussian family to model fish depth~length
+
> distance from shore:
>
> model1 <- glm(Depth ~ length + distance from shore,
> family=gaussian(link="log"))
>
> There are no zero depths. I would like to use the above model with the
> predict function in R to generate three lines (with confidence intervals)
> for the depth at size for three distances, say 100 m, 500 m and 1000m.
> Problem is I am unable to figure out how to do this?
>
> Any advice / assistance would be gratefully received...
>
> Thank you
>
> Tris
>
Something like:
pp <- expand.grid(distance=c(100,500,1000),
length=seq(min_depth,max_depth,length.out=51))
## 51 is arbitrary -- you just need enough points to make the curve
## appear smooth
predvals <- predict(model1,newdata=newdata,se.fit=TRUE,type="link")
pp <- transform(pp,est=exp(predvals$fit),
lwr=exp(predvals$fit-1.96*predvals$se),
upr=exp(predvals$fit+1.96*predvals$se))