reg.panel.sgl: Regression fit for panel sg-LASSO

View source: R/reg.panel.sgl.R

reg.panel.sglR Documentation

Regression fit for panel sg-LASSO

Description

Fits panel data sg-LASSO regression model.

The function fits sg-LASSO regression based on chosen tuning parameter selection method_choice. Options include cross-validation and information criteria.

Usage

reg.panel.sgl(x, y, gamma = NULL, gindex, intercept = TRUE, 
              method_choice = c("ic","cv"), nfolds = 10, 
              method = c("pooled", "fe"), nf = NULL, 
              verbose = FALSE, ...)

Arguments

x

NT by p data matrix, where NT and p respectively denote the sample size of pooled data and the number of regressors.

y

NT by 1 response variable.

gamma

sg-LASSO mixing parameter. γ = 1 gives LASSO solution and γ = 0 gives group LASSO solution.

gindex

p by 1 vector indicating group membership of each covariate.

intercept

whether intercept be fitted (TRUE) or set to zero (FALSE). Default is TRUE.

method_choice

choose between ic and cv. ic gives fit based on information criteria (BIC, AIC or AICc) by running ic.fit, while cv gives fit based on cross-validation by running cv.sglfit. If cv is chosen, optional number of folds nfolds can be supplied.

nfolds

number of folds of the cv loop. Default set to 10.

method

choose between 'pooled' and 'fe'; 'pooled' forces the intercept to be fitted in sglfit, 'fe' computes the fixed effects. User must input the number of fixed effects nf for method = 'fe', and it is recommended to do so for method = 'pooled'. Program uses supplied nf to construct foldsid if method_choice = 'cv' is chosen. Default is set to method = 'pooled'.

nf

number of fixed effects. Used only if method = 'fe'.

verbose

flag to print information.

...

Other arguments that can be passed to sglfit.

Details

The sequence of linear regression models implied by λ vector is fit by block coordinate-descent. The objective function is either (case method='pooled')

||y - ια - xβ||2NT + 2λ Ωγ(β),

where ι∈RNT and α is common intercept to all N items or (case method='fe')

||y - Bα - xβ||2NT + 2λ Ωγ(β),

where B = IN⊗ι and ||u||2NT=<u,u>/NT is the empirical inner product. The penalty function Ωγ(.) is applied on β coefficients and is

Ωγ(β) = γ |β|1 + (1-γ)|β|2,1,

a convex combination of LASSO and group LASSO penalty functions.

Value

reg.panel.sgl object.

Author(s)

Jonas Striaukas

Examples

 
set.seed(1)
x = matrix(rnorm(100 * 20), 100, 20)
beta = c(5,4,3,2,1,rep(0, times = 15))
y = x%*%beta + rnorm(100)
gindex = sort(rep(1:4,times=5))
reg.panel.sgl(x = x, y = y, 
  gindex = gindex, gamma = 0.5, 
  method = "fe", nf = 10, 
  standardize = FALSE, intercept = FALSE)


jstriaukas/midasml documentation built on Oct. 5, 2022, 12:18 a.m.