[R] glmer() -> corrected AUC optimism by bootstraping technic bootMer() [internal validation of a mixed-effects-model]
Bert Gunter
bgunter.4567 at gmail.com
Thu Mar 24 18:21:16 CET 2016
1. I cannot find a question here. Maybe I missed it. Maybe you should
be clearer.
2. You should most this on the mixed-models list, rather than here:
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Thu, Mar 24, 2016 at 6:34 AM, Andreu Ferrero Gmail
<fromnorden at gmail.com> wrote:
>
>
>>
>>
>> I would like to do an internal validation of a discriminative ability of a mixed effects models.
>>
>> Here is my scrip:
>>
>> ###########################
>> ####bootMer-> boot AUC#####
>> ###########################
>>
>> library(lme4)
>> library(lattice)
>> data(cbpp)
>>
>> #fit a model
>>
>> cbpp$Y<-cbpp$incidence>=1
>> glmm<-glmer(Y~period + size + (1|herd), family=binomial, data=cbpp)
>> glmm
>>
>> ##### funcio: versio 3 - no cal posar endpoint en la funcio
>> ##########################################################
>>
>>
>>
>> AUCFun <- function(fit) {
>> library(pROC)
>> pred<-predict(fit, type="response")
>> AUC<-as.numeric(auc(fit at resp$y, pred))
>> }
>>
>>
>> #test
>>
>> (AUCFun(glmm))
>>
>> ###run bootMer: AUCFun
>>
>>
>>
>> system.time(AUC.boot <- bootMer(glmm,nsim=100,FUN=AUCFun,seed=1982, use.u=TRUE,
>> type="parametric", parallel="multicore", ncpus=2))
>>
>>
>> #...
>>
>> (boot.ci(AUC.boot, index =c(1,1), type="norm"))
>>
>> roc(cbpp$Y, predict(glmm, type="response"))
>>
>>
>> #Now it seems more reasonable, bias as "optimism"... but still do not know #if I am just doing a AUC with bootstrap CI
>> **************************************************************************************************************************************
>>
>>
>>
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list