[R] What did I do wrong? Bootstrap with glm

Chunhao Tu tu_chunhao at yahoo.com
Fri Oct 2 05:46:41 CEST 2009


Hi R users,
I just play with a small data set (from SAS) by using the boot with glm. But
I don't know what I did wrong. Would someone please give me a hint?
> require(boot)
> carc<-read.table(file="C:\\Documents and
> Settings\\admin\\Desktop\\drug.txt",header=T)
> carc
     n  cc car age
1  500  42   S   1
2 1200  37   M   1
3  100   1   L   1
4  400 101   S   2
5  500  73   M   2
6  300  14   L   2
> dfd<-function(d,i){
+     d<-carc[i,]
+     car.glm<- glm(cc ~ car+age+offset(log(n)), family=poisson(link =
"log"), data=d)
+     coefficients(car.glm)
+     }
> 
> car.boot=boot(carc,dfd,9999)
Error in t.star[r, ] <- statistic(data, i[r, ], ...) : 
  number of items to replace is not a multiple of replacement length
Many Thanks
Tu http://www.nabble.com/file/p25710150/drug.txt drug.txt   
-- 
View this message in context: http://www.nabble.com/What-did-I-do-wrong--Bootstrap-with-glm-tp25710150p25710150.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list