initialise_commonfactorstructure_macropca {RCTS} | R Documentation |
Initialises the estimation of the common factors and their loadings.
Description
This is a short version of initialise_commonfactorstructure() which only contains implementations for the robust macropca case and the classical case.
Usage
initialise_commonfactorstructure_macropca(
Y,
X,
beta_est,
g,
factor_group,
k,
kg,
robust,
method_estimate_beta = "individual",
method_estimate_factors = "macro",
verbose = FALSE
)
Arguments
Y |
Y: NxT dataframe with the panel data of interest |
X |
dataframe with the observed variables |
beta_est |
estimated values of beta |
g |
Vector with estimated group membership for all individuals |
factor_group |
estimated group specific factors |
k |
number of estimated common factors |
kg |
vector with the number of estimated group specific factors |
robust |
TRUE or FALSE: defines using the classical or robust algorithm to estimate beta |
method_estimate_beta |
defines how beta is estimated. Default case is an estimated beta for each individual. Default value is "individual." Possible values are "homogeneous", "group" or "individual". |
method_estimate_factors |
specifies the robust algorithm to estimate factors: default is "macro". The value is not used when robust is set to FALSE. |
verbose |
when TRUE, it prints messages |
Value
list: 1st element contains the common factor(s) and the second element contains the factor loadings
Examples
set.seed(1)
original_data <- create_data_dgp2(30, 20)
Y <- original_data[[1]]
X <- original_data[[2]]
g <- original_data[[3]]
beta_est <- matrix(rnorm(4 * ncol(Y)), nrow = 4)
initialise_commonfactorstructure_macropca(Y, X, beta_est, g, NA, 0, c(3, 3, 3), TRUE)