Description Usage Arguments Details Value Author(s) See Also Examples
Wrapper function for glmnet
1 | ElasticNet(formula, data, nfolds = 10, ...)
|
formula |
Formula where the right hand side specifies the response and the left hand side the predictor matrix |
data |
A data frame in which |
nfolds |
nfolds: number of cross-validation folds in cv.glmnet (default in function is 10) |
... |
passed on to glmnet |
This function first calls cv.glmnet
and then
evaluates glmnet at the hyper parameter which optimizes the
cross-validation criterion.
Object with class ElasticNet
Thomas A. Gerds <tag@biostat.ku.dk>
predictStatusProb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Generate some data with binary response Y
# depending on X1 and X2 and X1*X2
set.seed(40)
N <- 40
X1 <- rnorm(N)
X2 <- rbinom(N,1,.4)
X3 <- rnorm(N)
expit <- function(x) exp(x)/(1+exp(x))
lp <- expit(1 + X1 + X2 + X3)
Y <- factor(rbinom(N,1,lp))
dat <- data.frame(Y=Y,X1=X1,X2=X2,X3=X3)
efit <- ElasticNet(Y~X1+X2+X3,data=dat,family="binomial",alpha=0.1)
Brier(efit,verbose=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.