calculate_PIC {RCTS}R Documentation

Function to determine PIC (panel information criterium)

Description

This depends on kappa1 -> kappaN, through p (=number of nonzero elements of beta_est). The parameter 'sigma2' is the non-robust sigma2. As it is only used in term 2 to 4, it does not actually matter what its value is (needs to be > 0). It could be set to 1 as well.

Usage

calculate_PIC(
  C,
  robust,
  S,
  k,
  kg,
  e2,
  sigma2,
  NN,
  TT,
  method_estimate_beta,
  beta_est,
  g,
  vars_est,
  choice_pic = "pic2017"
)

Arguments

C

determines relative contribution of the penalty terms compared to the estimation error term

robust

TRUE or FALSE: defines using the classical or robust algorithm to estimate beta

S

number of estimated groups

k

number of common factors to be estimated

kg

number of group specific factors to be estimated

e2

NxT matrix with error terms

sigma2

scalar: sum of squared error terms, scaled by NT

NN

number of time series

TT

length of time series

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

beta_est

estimated values of beta

g

Vector with estimated group membership for all individuals

vars_est

number of variables that will be included in the algorithm and have their coefficient estimated. This is usually equal to the number of observable variables.

choice_pic

indicates which PIC to use to estimate the number of groups and factors: options are "pic2017" (uses the PIC of Ando and Bai (2017); works better for large N), "pic2016" (Ando and Bai (2016); works better for large T) weighs the fourth term with an extra factor relative to the size of the groups, and "pic2022" which shrinks the NT-space where the number of groups and factors would be over- or underestimated compared to pic2016 and pic2017.

Value

numeric

Examples

set.seed(1)
NN <- 30
TT <- 10
e <- matrix(rnorm(NN * TT), nrow = NN)
beta_est <- matrix(rnorm(NN * 4), ncol = NN) #random values for beta
g <- round(runif(NN, 1, 3))
calculate_PIC(0.51, TRUE, 3, 0, c(3, 3, 3), e, e^2/(NN*TT), NN, TT, "individual", beta_est, g, 3)

[Package RCTS version 0.2.4 Index]