estimate_factor_group {RCTS}R Documentation

Estimates group factors Fg.

Description

Estimates group factors Fg.

Usage

estimate_factor_group(
  Y,
  X,
  beta_est,
  g,
  lambda,
  comfactor,
  factor_group,
  S,
  k,
  kg,
  robust,
  method_estimate_beta = "individual",
  method_estimate_factors = "macro",
  initialise = FALSE,
  verbose = FALSE
)

Arguments

Y

Y: NxT dataframe with the panel data of interest

X

X: NxTxp array containing the observable variables

beta_est

estimated values of beta

g

Vector with group membership for all individuals

lambda

loadings of the estimated common factors

comfactor

estimated common factors

factor_group

estimated group specific factors

S

number of estimated groups

k

number of common factors to be estimated

kg

number of group specific factors to be estimated

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

defines method of robust estimaton of the factors: "macro", "pertmm" or "cz"

initialise

indicator of being in the initialisation phase

verbose

when TRUE, it prints messages

Value

Returns a list with an element for each estimated group. Each element of the list is a matrix with the group specific factors as rows.

Examples

#example with data generated with DGP 2
data <- create_data_dgp2(30, 10)
Y <- data[[1]]
X <- data[[2]]
g <- data[[3]] #true group membership
set.seed(1)
beta_est <- matrix(rnorm(4 * nrow(Y)), nrow = 4)
factor_group <- data[[5]] #true values of group specific factors
comfactor <- matrix(0, nrow = 1, ncol = ncol(Y))
lambda <- matrix(0, nrow = 1, ncol = nrow(Y))
estimate_factor_group(Y, X, beta_est, g, lambda, comfactor, factor_group,
3, 0, c(3, 3, 3), TRUE)

[Package RCTS version 0.2.4 Index]