Learn R Programming

ablasso (version 1.1)

ablasso_mv_ss: AB-LASSO Estimator with Random Sample Splitting for Multivariate Models

Description

Implements the AB-LASSO estimation method for the multivariate model \(Y_{it} = \alpha_{i} + \gamma_{t} + \sum_{j=1}^{L} \beta_{j} Y_{i,t-j} + \theta_{0} D_{it} + \theta_{1} C_{i,t-1} + \varepsilon_{it}\), with random sample splitting. Note that \(D_{it}\) and \(C_{it}\) are predetermined with respect to \(\varepsilon_{it}\).

Usage

ablasso_mv_ss(Y, D, C, lag = 1, Kf = 2, nboot = 100, seed = 202302)

Value

A dataframe that includes the estimated coefficients (\(\beta_{j}, \theta_{0}, \theta_{1}\)), their standard errors, and T-statistics.

Arguments

Y

A P x N (number of time periods x number of individuals) matrix containing the outcome/response variable Y.

D

A P x N (number of time periods x number of individuals) matrix containing the policy variable/treatment D.

C

A list of P x N matrices containing other treatments and control variables.

lag

The lag order of \(Y_{it}\) included in the covariates, default is 1.

Kf

The number of folds for K-fold cross-validation, with options being 2 or 5, default is 2.

nboot

The number of random sample splits, default is 100.

seed

Seed for random number generation, default 202302.

Examples

Run this code
# \donttest{
# Use the Covid data
N = length(unique(covid_data$fips))
P = length(unique(covid_data$week))
Y = matrix(covid_data$logdc, nrow = P, ncol = N)
D = matrix(covid_data$dlogtests, nrow = P, ncol = N)
C = list()
C[[1]] = matrix(covid_data$school, nrow = P, ncol = N)
C[[2]] = matrix(covid_data$college, nrow = P, ncol = N)
C[[3]] = matrix(covid_data$pmask, nrow = P, ncol = N)
C[[4]] = matrix(covid_data$pshelter, nrow = P, ncol = N)
C[[5]] = matrix(covid_data$pgather50, nrow = P, ncol = N)

results.kf2 <- ablasso_mv_ss(Y = Y, D = D, C = C, lag = 4, nboot = 2)
print(results.kf2)
results.kf5 <- ablasso_mv_ss(Y = Y, D = D, C = C, lag = 4, Kf = 5, nboot = 2)
print(results.kf5)
# }

Run the code above in your browser using DataLab