> 
> 
> 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@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@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