[R] Semi Parametric Bootstrap

Paul Musingila pmusingila at gmail.com
Thu Jan 10 12:39:17 CET 2013


Greetings to you all,

I am performing a semi parametric bootstrap in R on a Gamma Distributed 
data and a Binomial distributed data. The main challenge am facing is 
the fact that the residual variance depends on the mean (if I am correct).
I strongly feel that the script below may be wrong due to mean-variance 
relationship

#####R code#######
fit1s <-glm(mydata$vzv~mydata$age.c+mydata$age2+mydata$sex1, 
family=Gamma(link=log))
x.betahat1<-fit1s$fitted.values
res1<-fit1s$residuals
b<-1000
for (i in 1:b){
     b.i <- sample(index, size=n, replace=T)
     res.star1=res1[b.i]

     bst1=x.betahat1+res.star1
     mydata1 <-data.frame(age,age2,sex,bst1)
     ########Modeling ################
     fit11 <-glm(bst1~age+age2+sex, family=Gamma(link=log),data=mydata1)
     }

  Can someone help me correct this code? Kindly advice on Binomial data 
as well

Happy New year2013!
-- _______________________________
Paul K. Musingila




More information about the R-help mailing list