if (FALSE) {
# example from glmnet package
set.seed(10101)
library(glmnet)
library(survival)
library(peperr)
N=1000;p=30
nzc=p/3
x=matrix(rnorm(N*p),N,p)
beta=rnorm(nzc)
fx=x[,seq(nzc)]
hx=exp(fx)
ty=rexp(N,hx)
tcens=rbinom(n=N,prob=.3,size=1)# censoring indicator
y=Surv(ty,1-tcens)
peperr.object <- peperr(response=y, x=x,
fit.fun=fit.glmnet, args.fit=list(family="cox"),
complexity=complexity.glmnet,
args.complexity=list(family="cox",nfolds=10),
indices=resample.indices(n=N, method="sub632", sample.n=10))
# pointwise bootstrap quantiles and all error types
Plot.peperr.curves(peperr.object, allErrors=TRUE)
# individual bootstrap runs and selected error types
Plot.peperr.curves(peperr.object, allErrors=FALSE, bootRuns=TRUE)
}
Run the code above in your browser using DataLab