Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

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

share|improve this question
1  
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.

1 Answer

I think the part of the code:

bst1=x.betahat1+res.star1

assumes that the residuals obtained from the gamma density are normal. However gamma distribution is usually not normally distributed (if I am correct). So what orientation should one assume so that the correct distribution of the residuals is correctly specified above?

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.