gesso.predict: Predict new outcome vector

Description Usage Arguments Value Examples

View source: R/gesso.R

Description

Predict new outcome vector based on the new data and estimated model coefficients.

Usage

1
2
gesso.predict(beta_0, beta_e, beta_g, beta_gxe, new_G, new_E, 
                   beta_c=NULL, new_C=NULL, family = "gaussian")

Arguments

beta_0

estimated intercept value

beta_e

estimated environmental coefficient value

beta_g

a vector of estimated main effect coefficients

beta_gxe

a vector of estimated interaction coefficients

new_G

matrix of main effects, variables organized by columns

new_E

vector of environmental measurments

beta_c

a vector of estimated confounders coefficients

new_C

matrix of confounders, variables organized by columns

family

set family="gaussian" for the continuous outcome and family="binomial" for the binary outcome with 0/1 levels

Value

Returns a vector of predicted values

Examples

1
2
3
4
5
6
7
8
9
data = data.gen()
tune_model = gesso.cv(data$G_train, data$E_train, data$Y_train)
coefficients = gesso.coef(tune_model$fit, tune_model$lambda_min)
beta_0 = coefficients$beta_0; beta_e = coefficients$beta_e                   
beta_g = coefficients$beta_g; beta_gxe = coefficients$beta_gxe     

new_G = data$G_test; new_E = data$E_test
new_Y = gesso.predict(beta_0, beta_e, beta_g, beta_gxe, new_G, new_E)
cor(new_Y, data$Y_test)^2

gesso documentation built on Nov. 30, 2021, 9:09 a.m.