Learn R Programming

sommer (version 4.3.6)

H: Two-way id by features table

Description

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.

Usage

H(timevar=NULL, idvar=NULL, response=NULL, Gu=NULL)

Value

$H

two way table of id by features effects.

Arguments

timevar

vector of the dataset containing the variable to be used to form columns in the wide table.

idvar

vector of the dataset containing the variable to be used to form rows in the wide table.

response

vector of the dataset containing the response variable to be used to fill the cells of the wide table.

Gu

an optional covariance matrix (not the inverse) between levels of the idvar in case a sparse (unbalanced) design between timevar and idvar exist.

Author

Giovanny Covarrubias-Pazaran

Details

This is just an aggregate, reshape and imputation of a long format table to a wide format table.

See Also

The function vsc to know how to use H in the rrc function.

Examples

Run this code

# 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