| fa.sglfit | R Documentation |
Estimates factor-augmented sparse MIDAS regression model
The function first computes factors on MIDAS-weighted regressors x.
Then the function runs cv.sglfit to fit the model. The output can be passed to predict.fa.sglfit to obtain predictions.
fa.sglfit(x, y, f = NULL, K = NULL, gamma = 1.0, gindex = 1:nvars,
...)
x |
T by p data matrix, where T and p respectively denote the sample size and the number of regressors. |
y |
T by 1 response variable. |
f |
T by K latent factors. If null, the factors are estimated by using Principal Component Analysis (PCA). In this case, the number of optimal factors is selected by appyling eigenvalue ratio estimator of Ahn and Horenstein (2013). |
K |
number of factors. If |
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. |
... |
Other arguments that can be passed to cv.sglfit. |
fa.sglfit object.
set.seed(1)
x = matrix(rnorm(100 * 20), 100, 20)
beta = c(5,4,3,2,1,rep(0, times = 15))
f = matrix(rnorm(100 * 2), 100, 2)
g = c(0.5, 0.5)
y = x%*%beta + f%*%g + rnorm(100)
gindex = sort(rep(1:4,times=5))
fa.sglfit(x = x, y = y, f = f, gindex = gindex, gamma = 0.5,
standardize = FALSE, intercept = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.