predict.IMLEGIT: Predictions of IMLEGIT fits

Description Usage Arguments Format Value Examples

View source: R/LEGIT.R

Description

Predictions of IMLEGIT fits.

Usage

1

Arguments

object

An object of class "IMLEGIT", usually, a result of a call to IMLEGIT.

data

data.frame of the dataset to be used.

latent_var

list of data.frame. The elements of the list are the datasets used to construct each latent variable. For interpretability and proper convergence, not using the same variable in more than one latent variable is highly recommended. It is recommended to set names to the list elements to prevent confusion because otherwise, the latent variables will be named L1, L2, ...

...

Further arguments passed to or from other methods.

Format

An object of class function of length 1.

Value

Returns a vector with the predicted values.

Examples

1
2
3
4
5
6
7
train = example_2way(250, 1, seed=777)
test = example_2way(100, 1, seed=666)
fit = IMLEGIT(train$data, list(G=train$G, E=train$E), y ~ G*E)
ssres = sum((test$data$y - predict(fit, test$data, list(G=test$G, E=test$E)))^2)
sstotal = sum((test$data$y - mean(test$data$y))^2)
R2 = 1 - ssres/sstotal
R2

AlexiaJM/LEGIT documentation built on Feb. 14, 2021, 8:24 p.m.