powered by
H creates a two way id by features table that can be used as the H argument in the rrc function that extracts latent covariates.
H
rrc
H(timevar=NULL, idvar=NULL, response=NULL, Gu=NULL)
two way table of id by features effects.
vector of the dataset containing the variable to be used to form columns in the wide table.
vector of the dataset containing the variable to be used to form rows in the wide table.
vector of the dataset containing the response variable to be used to fill the cells of the wide table.
an optional covariance matrix (not the inverse) between levels of the idvar in case a sparse (unbalanced) design between timevar and idvar exist.
Giovanny Covarrubias-Pazaran
This is just an aggregate, reshape and imputation of a long format table to a wide format table.
The function vsc to know how to use H in the rrc function.
vsc
# data(DT_h2) # DT <- DT_h2 # DT=DT[with(DT, order(Env)), ] # H0 <- with(DT, H(Env, Name, y) ) # Z <- with(DT, rrc(Env, H0, 2))
Run the code above in your browser using DataLab