add_pic {RCTS}R Documentation

Fills in df_pic: adds a row with the calculated PIC for the current configuration.

Description

Fills in df_pic: adds a row with the calculated PIC for the current configuration.

Usage

add_pic(
  df,
  index_configuration,
  robust,
  Y,
  beta_est,
  g,
  S,
  k,
  kg,
  est_errors,
  C_candidates,
  method_estimate_beta = "individual",
  choice_pic = "pic2017"
)

Arguments

df

input data frame

index_configuration

index of the configuration of groups and factors

robust

robust or classical estimation

Y

Y: NxT dataframe with the panel data of interest

beta_est

estimated values of beta

g

Vector with estimated group membership for all individuals

S

number of estimated groups

k

estimated number of common factors

kg

vector with the estimated number of group specific factors for each group

est_errors

NxT matrix with the error terms

C_candidates

candidates for C (parameter in PIC)

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".

choice_pic

parameter that defines which PIC is used to select the best configuration of groups and factors. Options are "pic2017" (uses the PIC of Ando and Bai (2017)), "pic2016" (Ando and Bai (2016)) weighs the fourth term with an extra factor relative to the size of the groups, and "pic2022". They differ in the penalty they perform on the number of group specific factors (and implicitly on the number of groups). They also differ in the sense that they have different NT-regions (where N is the number of time series and T is the length of the time series) where the estimated number of groups, and thus group specific factors will be wrong. Pic2022 is designed to shrink the problematic NT-region to very large N / very small T).

Value

data.frame

Examples

set.seed(1)
original_data <- create_data_dgp2(30, 10)
Y <- original_data[[1]]
g <- original_data[[3]]
beta_est <- matrix(rnorm(4 * nrow(Y)), nrow = 4)
df_pic <- initialise_df_pic(1:5)
e <- matrix(rnorm(nrow(Y) * ncol(Y)), nrow(Y))
add_pic(df_pic, 1, TRUE, Y, beta_est, g, 3, 0, c(3, 3, 3), e, 1:5)

[Package RCTS version 0.2.4 Index]