Dear experts,
>
>
>I have done a multiple linear regression on a small sample size (n=22).
>I have computed the prediction intervals (not the confidence intervals).
>
>
>Now I am trying to bootstrap the prediction intervals.
>
>
>I didn't find any package doing that.
>So I decide to create my own R function, but it doesn't work !
>
>
>Here are my R codes :
>
>
>LinearModel.1 <- lm(GDP.per.head ~ Competitivness.score +Quality.score, 
>data=Dataset)
>summary(LinearModel.1)
>predict(LinearModel.1, interval = "prediction")
>
>
>HERE IS MY R FUNCTION WHERE I HAVE TRIED TO BOOTSTRAP THE PREDICTION INTERVALS
>
>
>pred.min<-rep(nrow(Dataset), na.rm=F)
>pred.max<-rep(nrow(Dataset), na.rm=F)
>for(i in 1:n) 
>{s<-sample(1:nrow(Dataset),size=22)
>reg<-lm(GDP.per.head ~ Competitivness.score + Quality.score,data=Dataset[s])
>pred.min<-pmin(reg,pred.min)
>pred.max<-pmax(reg,pred.max)}
>
>
>Thanks for your precious help.
>
>
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to