**9. References**

16 Will-be-set-by-IN-TECH

if (option=="gam") {formula=paste("+s(X[,",j,"])",sep="")}

if (option=="gam") {modelo=gam(as.formula(formula),

else {modelo=glm(as.formula(formula),family="binomial",

a=EmpiricalROC(Y[Wtraining==0],muhat[Wtraining==0])

nvars=c(nvars,ivar);aucs=c(aucs,aux);auc=c(auc,aux)

ROCs=rbind(ROCs,cbind(rep(ivar,jj),rep(aux,jj),a\$t,a\$ROC))}

else { formula0=paste("(X[,",inside,"])",sep="",collapse="+")}}

##################################################################

if (option=="gam") {formula0=paste("s(X[,",inside,"])",

variables=1:nvar

test<-seq(1,n,4)

auc=NULL

for (ivar in 1:nvar) {

weights=Wtraining)}

auc0=c(auc0,max(auc))

sep="",collapse="+")}

return(list(aucs=cbind(nvars,aucs),

EmpiricalROC<-function (group,Y){ YE=Y[ group==1]; YS=Y[ group==0]

aux=a\$auc

}

jj=length(a\$t)

ROC=as.vector(ROC)

diffmat<-ymat-xmat

t=c(0,t,1); ROC=c(0,ROC,1) m<-length(YS);n<-length(YE)

auc0=NULL; formula0=NULL; inside=NULL

Wtraining=rep(1,n);Wtraining[test]=0

for (j in 1:length(variables)) {

else {formula=paste("+(X[,",j,"])",sep="")} formula=paste(formula0,formula,sep="") formula=paste("Y~",formula,sep="")

family="binomial",weights=Wtraining)}

muhat=predict(modelo,type="response")

inside=c(inside,variables[which.max(auc)])

aucopt=cbind(1:nvar,auc0),models=inside,roc=ROCs))

t=seq(0,1,0.01); F=quantile(YS,probs=(1-t),type=1)
