bigi001 bigi001
2009-May-12 00:36 UTC
[R] Bootstrap error rate of logistic disrmination model
Hi,
i am trying to find an appopriate R function which will estimate the bias
associated with the apparent error rate of my logistic discriminant model
(groups = 2, covariates = 3). I have read that bootstrapping can be used for
this. Does anyone have any ideas on how I can go about doing this?
I have quite a small sample size for one of my groups and I realize this may
cause some problems, but as i can't increase my sample size nor decrease the
number of covariates, I am hoping this could work. Maybe adjusting the
bootstrap function to maintain the same group ratios as the original data
when the bootstrap sample is randomly chosen.
I have been using the bellow function for linear dicriminant function error
bias estimation but when using it for my logistic models i come into
problems with the predict function calculating probabilities instead
of group allocation as for lda(). In that case maybe someone knows of a
function which predicts goup allocations for data in a logistic reggression
that i can use.
df=function(data,index){
boot.df=lda(x=white[index,4:6],group=white[index,3])
boot.pr=predict(boot.df)
boot.resub=sum(boot.pr$class!=white[index,3])/nrow(white)
data.pr=predict(boot.df,white[,4:6])
data.resub=sum(data.pr$class!=white[,3])/nrow(white)
bias=data.resub-boot.resub
bias
}
boot(white[,4:13],df,R=500,strata=white[,3])
I realise doing this bootstrap could be very time intensive for the computer
and would most probably not be ideal due to my small sample size, so any
ideas would be very welcome.
Regards,
Branislav Igic
[[alternative HTML version deleted]]
