[R] loop question

From: Thomas <thomas.triebs_at_cantab.net>
Date: Tue, 05 Apr 2011 16:33:11 +0100


Dear all,

I am trying to set up a list with 1:c objects each meant to capture the coefficients for one coefficient and 100 replications. I receive the following error message:

Error in betaboot[[p]] : subscript out of bounds.

My code is below. Where is my mistake?

Many thanks,

Thomas



betaboot<-list(NULL)

for (i in 1:c) {
betaboot[[i]]<-cbind()
}

num <- 100 # this is the number of bootstraps

for (i in 1:num) {

     [BOOTSTRAP]    coef.temp <- coef(model.temp, data=newdata)

   for (p in 1:c){
   betaboot[[p]] <- cbind(betaboot[[p]], coef.temp[,p])
}

}



R-help_at_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. Received on Tue 05 Apr 2011 - 15:45:04 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 05 Apr 2011 - 16:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive