Solved – How to add confidence intervals to predicted data when the response variable is log transformed

I'm trying to predict the impact of avg grasshopper density(ghavg) on plant biomass. Both the response and predictor are continuous data. I had to log transform biomass (logmass) for a normal distribution, giving the following dataset:

logmass = c(8.032393925,7.439531107,7.307924891,7.036315375,6.679316231,6.545784839,6.414481385,6.39297518,6.209312602,6.209312602,5.698486978,4.862609605,4.367692388,3.608137836)  ghavg = c(30.4,30.4,7.7,124.8,7.7,7.7,123.2,30.4,21.1,21.1,21.1,123.2,47.9,124.8) 

In R I ran a glm:


To predict the effect of grasshoppers on plant biomass (up to 300 m2) I ran:

nd<-data.frame(ghavg=0:300) pred_mass<-predict.glm(biomass,type="response",newdata=nd)               

Then back transformed the output with:


I think this works well but I would now like to add confidence intervals to the prediciton. I tried:


but the standard errors are clearly off when back transformed.

Any assistance on how to properly add CI's to predicted values from transformed data would be greatly appreciated

@ogrisel: bootstrap seems overkill here! rather:

preds <- predict.glm(biomass,type="response",,newdata=nd)  logci <- preds$fit+(preds$se)%*%t(qnorm(c(0.025,0.5,0.975))) ci <- exp(logci) dimnames(ci)[[2]]<-c("lower95", "est", "upper95") 

should work (if confidence intervals for predictions are actually what you want)


Similar Posts:

Rate this post

Leave a Comment