Description Usage Arguments Examples
Predict the generalized linear model with a vector of penalty parameters.
1 | glmPenaltyPred(object, xnew, type = c("response", "probability", "link"))
|
object |
the vector of the response variable. |
xnew |
the matrix of the predictors. |
type |
string. One of the response families, "response", "probability" or "link". |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Generate data of continuous response
trueb0 <- 1
trueact <- c(1, 1, 1, 0, 0, 0, 0, 0, 0, 0)
trueb <- runif(10, -1, 1)*10
trueb[which(trueact == 0)] <- 0
df <- glmDataGen(n = 500, d = 10, family = "gaussian", trueb0, trueb, s = 0.5, seed = 1)
# Run cross-validation
mdlcv <- glmPenaltyCV(y = df$y, x = df$x, family = "gaussian", lambdaLength = 200,
minLambdaRatio = 1e-3, maxit = 1e5, tol = 1e-7, alpha = 0.5, nfolds = 10, ver = "arma")
# Predict for new data
xnew <- matrix(rnorm(10), 1, 10)
yp <- glmPenaltyPred(mdlcv, xnew)
yp[,mdlcv$lambdaBestId]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.