predict.LEGIT: Predictions of LEGIT fits

Description Usage Arguments Format Value Examples

View source: R/LEGIT.R

Description

Predictions of LEGIT fits.

Usage

1

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.

Format

An object of class function of length 1.

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

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