Description Usage Arguments Value Examples
Cross-validation frequentist model averaging for generalized linear models. The candidate models are selected by adaptive LASSO.
1 2 3 4 5 |
x |
the matrix of regressors, excluding the intercept. |
y |
the vector of response variable. |
focus |
"mu" or "eta". |
family |
"binomial" or "poisson". |
nlambda |
the number of lambda. Default is 100. |
nfolds |
the number of folds in cross validation. Default equals the sample size. |
grouped |
same as grouped in the glmnet package. |
penalty.factor |
It will be passed to penalty.factor in the glmnet package. Default is a vector of 1, indicating same scaling. If penalty.factor is a numerical vector, it will be directly passed to cv.glment(). If penalty.factor="adaptiveLasso", the weight will be the reciporacal of the absolute value of the full model estimates. |
force.nlambda |
it is common that the user specify a value of nlambda, but the actual number of lambda is lower than nlambda. If force.nlambda = TRUE, the number of lambda values is forced to be nlambda by forming a better lambda sequence. |
singleton.intercept.only |
if TRUE, then the interpcet only model is also included in the singleton models. FALSE means that the intercept only model is left out. |
type.measure |
same as type.measure in the glmnet package. |
rule |
a vector that contains entries from "IMSE", "Singleton", and "Hybrid". "IMSE" averages the lambda sequence produced from the glmnet package, which aims to approximate the integrated MSE. |
solnptol |
tolerance used in solnp(). |
qp.scale |
"max" or "1/n". "max" means that the raw symmetric matrix in QP is divided by the max number of the matrix. "1/n" means that it is divided by the sample size. |
glmnetfit |
The user can fit a glmnet object themselves and pass it to the function to save time. It is not provided, a glmnet object will be fitted in the function. |
It returns a list of the following objects
fullcoef: estimated beta from the full model.
penalty.factor: the weights for each covariate.
IMSE: if "IMSE" belongs to rule, then it contains a list of the following objects.
w: estimated weights.
convergence: 0 or converged = converged.
avecoef: averaged beta coefficients, if focus = "eta".
elapsed: elapsed time in seconds, if focus = "eta".
lambda: the lambda sequence.
pos_def: whether QP is positive definite, if focus = "mu".
coef: the matrix containing all estimated beta (excluding the full model), if focus = "mu".
Hybrid: if "Hybrid" belongs to rule, then it contains a list of the following objects.
w: estimated weights.
convergence: 0 or converged = converged.
avecoef: averaged beta coefficients, if focus = "eta".
elapsed: elapsed time in seconds, if focus = "eta".
models: unique model structures.
pos_def: whether QP is positive definite, if focus = "mu".
coef: the matrix containing all estimated beta, if focus = "mu".
Singleton: if "Singleton" belongs to rule, then it contains a list of the following objects.
w: estimated weights.
convergence: 0 or converged = converged.
avecoef: averaged beta coefficients, if focus = "eta".
elapsed: elapsed time in seconds, if focus = "eta".
pos_def: whether QP is positive definite, if focus = "mu".
coef: the matrix containing all estimated beta, if focus = "mu".
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | data("ToyData_Binomial")
fma.glmnet(x = ToyBinomial[1 : 100, paste("x", 1 : 8, sep = "")],
y = ToyBinomial[1 : 100, "y"],
focus = "mu",
family = "binomial",
nlambda = 50,
nfolds = 10,
penalty.factor = "adaptiveLasso",
grouped = FALSE,
type.measure = "class",
rule = c("IMSE", "Hybrid", "Singleton"),
solnptol = 1e-08,
force.nlambda = TRUE,
qp.scale = "max",
singleton.intercept.only = TRUE)
fma.glmnet(x = ToyBinomial[1 : 100, paste("x", 1 : 8, sep = "")],
y = ToyBinomial[1 : 100, "y"],
focus = "eta",
family = "binomial",
nlambda = 50,
nfolds = 10,
penalty.factor = "adaptiveLasso",
grouped = FALSE,
type.measure = "class",
rule = c("IMSE", "Hybrid", "Singleton"),
solnptol = 1e-08,
force.nlambda = TRUE,
qp.scale = "max",
singleton.intercept.only = TRUE)
data("ToyData_Poisson")
fma.glmnet(x = ToyPoisson[1 : 100, paste("x", 1 : 8, sep = "")],
y = ToyPoisson[1 : 100, "y"],
focus = "mu",
family = "poisson",
nlambda = 50,
nfolds = 10,
penalty.factor = "adaptiveLasso",
grouped = FALSE,
type.measure = "mse",
rule = c("IMSE", "Hybrid", "Singleton"),
solnptol = 1e-08,
force.nlambda = TRUE,
qp.scale = "max",
singleton.intercept.only = TRUE)
fma.glmnet(x = ToyPoisson[1 : 100, paste("x", 1 : 8, sep = "")],
y = ToyPoisson[1 : 100, "y"],
focus = "eta",
family = "poisson",
nlambda = 50,
nfolds = 10,
penalty.factor = "adaptiveLasso",
grouped = FALSE,
type.measure = "mse",
rule = c("IMSE", "Hybrid", "Singleton"),
solnptol = 1e-08,
force.nlambda = TRUE,
qp.scale = "max",
singleton.intercept.only = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.