[R-sig-ME] ¿Can I do an internal validation of glmer()? ¿By glmer() -> corrected AUC optimism by bootstraping technic bootMer() [internal validation of a mixed-effects-model]?
Andreu Ferrero
fromnorden at gmail.com
Thu Mar 24 19:36:47 CET 2016
¿ Can I do an internal validation in a mixed-effect-model?
Here is some code:
>
>
>
>>
>>
>> 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)
library(boot)
>> 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
>> **************************************************************************************************************************************
>
More information about the R-sig-mixed-models
mailing list