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 am correct). I strongly feel that the script below may be wrong due to mean-variance relationship. my aim is to get the confidence intervals/SE for the parameter estimates
#####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
POLY