predict.LEGIT: Predictions of LEGIT fits

Description Usage Arguments Value Examples

View source: R/LEGIT.R

Description

Predictions of LEGIT fits.

Usage

1
2
## 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

1
2
3
4
5
6
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

Example output

Loading required package: formula.tools
Converged in 7 iterations

LEGIT documentation built on Jan. 12, 2022, 1:08 a.m.