# \donttest{
X <- X_dgp3
Y <- Y_dgp3
# Set estimations for group factors and its loadings, and group membership to the true value
lambda_group <- lambda_group_true_dgp3
factor_group <- factor_group_true_dgp3
g_true <- g_true_dgp3 # true values of group membership
g <- g_true # estimated values of group membership; set in this example to be equal to true values
# There are no common factors to be estimated -> use placeholder with values set to zero
lambda <- matrix(0, nrow = 1, ncol = 300)
comfactor <- matrix(0, nrow = 1, ncol = 30)
# Choose how coefficients of the observable are estimated
beta_est <- estimate_beta(
Y, X, NA, g, lambda_group, factor_group,
lambda, comfactor,
S = 3, k = 0, kg = c(3, 3, 3),
vars_est = 3, robust = TRUE
)[[1]]
g_new <- update_g(
Y, X, beta_est, g,
factor_group, lambda, comfactor,
S = 3,
k = 0,
kg = c(3, 3, 3),
vars_est = 3,
robust = TRUE,
"macro", "individual"
)[[1]]
# }
Run the code above in your browser using DataLab