# Gamma and binomial semi-parametric bootstrap [closed]

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 ################
}


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

POLY

-
Could you please indicate what precisely is wrong with the code? What output are you expecting, what are you getting, and how do they differ? If you have a question about statistical methodology, and not just coding, then please state it as clearly as possible (which usually means using English and mathematical notation, because code is not sufficiently expressive and is not universally understood). – whuber Jan 10 at 14:52
Thank you Whuber for ur concern. May major problem is how to specify the relationship between the errors and the design matrix. If you look at the code above you will notice that I specified it in a way that you will correctly specify it in a Gaussian bootstrap. the standard errors that results from the above specification are quite suspect, that is they are very small. – Poly Jan 10 at 18:39
Without having any information at all about your data, I don't see how it would be possible to give any opinion about the error structure. – whuber Jan 10 at 19:04
Am not sure whether am getting your question well. am working with some biological data about antibody levels as a response variable and Age, sex as the covariates. A gamma model gives me the best fit according to AIC and am therefore fitting a Gamma model. Am also required to get the confidence intervals for the parameter estimates using the three bootstrap methods. I can do this easily using Parametric and non parametric bootstrap. However I need the semi parametric as estimates as well. I hope this makes is a bit clear. – Poly Jan 10 at 19:43

## closed as not a real question by Macro, Andy W, gung, cardinal, chl♦Jan 14 at 19:15

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

bst1=x.betahat1+res.star1