fmaglmnet: Frequentist model averaging of adaptive LASSO in GLM

Description Usage Arguments Value Examples

Description

Cross-validation frequentist model averaging for generalized linear models. The candidate models are selected by adaptive LASSO.

Usage

1
2
3
4
5
fma.glmnet( x, y, focus, family, nlambda = 100, nfolds = NULL, grouped,
            penalty.factor = NULL, force.nlambda,
            singleton.intercept.only = FALSE,
            type.measure = "mse", rule, solnptol, qp.scale,
            glmnetfit = NULL)

Arguments

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.

Value

It returns a list of the following objects

Examples

 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)

shaji948/FMAglm documentation built on Dec. 23, 2021, 1:17 a.m.