H: Two-way id by features table

View source: R/FUN_special.R

HR Documentation

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)

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.

Details

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

Value

$H

two way table of id by features effects.

Author(s)

Giovanny Covarrubias-Pazaran

See Also

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

Examples


# 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))



sommer documentation built on Sept. 11, 2024, 6:22 p.m.