Hi

I have a data with an outcome,Y and 10 predictors (X1-X10).
My aim is to fit a logistic model to each of the predictors and calculate the 
deviance difference (dDeviance).
And later on bootstrapping the dDeviance for 100 times (R=100).
I tried the following function. It is calculating the original dDeviance 
correctly. But, when I checked the mean bootstrap values, it differs greatly 
from the original.
I suspect I made a mistake with the bootstrapping function, which I need help 
with.
I attached the script if you need to look at it.

Thank you in advance.


set.seed(111)

yfunction <- function(data,indices)
{
glm.snp1 <- glm(Y~data[indices], family="binomial", data=datasim)
null <- glm.snp1$null.deviance
residual <- glm.snp1$deviance
dDeviance <-(null-residual)
return(dDeviance)
}

mybootstrap <- function(data)
{
boot(data,yfunction, R=100)
}

resulty <- lapply(datasim[,-1],function(x)mybootstrap(x))
bootresult <- sapply(datasim[,-1],function(x)mybootstrap(x)$t)
colMeans(bootresult)



-shima-

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to