predict.LEGIT: Predictions of LEGIT fits

View source: R/LEGIT.R

predict.LEGITR Documentation

Predictions of LEGIT fits

Description

Predictions of LEGIT fits.

Usage

## S3 method for class 'LEGIT'
predict(object, data, genes, env, ...)

Arguments

object

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

data

data.frame of the dataset to be used.

genes

data.frame of the variables inside the genetic score G (can be any sort of variable, doesn't even have to be genetic).

env

data.frame of the variables inside the environmental score E (can be any sort of variable, doesn't even have to be environmental).

...

Further arguments passed to or from other methods.

Value

Returns a vector with the predicted values.

Examples

train = example_2way(250, 1, seed=777)
test = example_2way(100, 1, seed=666)
fit = LEGIT(train$data, train$G, train$E, y ~ G*E)
ssres = sum((test$data$y - predict(fit, test$data, test$G, test$E))^2)
sstotal = sum((test$data$y - mean(test$data$y))^2)
R2 = 1 - ssres/sstotal

LEGIT documentation built on May 29, 2024, 7:27 a.m.