calculate_errors_virtual_groups {RCTS} | R Documentation |
Helpfunction for update_g(). Calculates the errors for one of the possible groups time series can be placed in.
Description
During the updating of group membership, the errorterm is used as the objective function to estimate the group.
Usage
calculate_errors_virtual_groups(
group,
LF,
virtual_grouped_factor_structure,
NN,
TT,
k,
kg,
vars_est,
method_estimate_beta,
Y,
X,
beta_est,
g
)
Arguments
group |
group |
LF |
NxT-matrix of the common factorstructure |
virtual_grouped_factor_structure |
list with length the number of groups; every element of the list contains NxT-matrix |
NN |
number of time series |
TT |
length of time series |
k |
number of common factors to be estimated |
kg |
number of group specific factors to be estimated |
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. |
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". |
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 |
Value
NxT matrix with the errorterms (=Y minus the estimated factorstructure(s) and minus X*beta)