anchor_prediction: anchor_prediction

Description Usage Arguments Value Examples

View source: R/anchor_prediction.R

Description

Perform a prediction for an Anchor Regression model as described in Rothenhäusler et al.2020

Usage

1
anchor_prediction(anchor_model, x, anchor, gamma, target_variable)

Arguments

anchor_model

is the Anchor Regression model object

x

is a dataframe containing the matrix x containing the independent variables

anchor

is a dataframe containing the matrix anchor containing the anchor variable

gamma

is the regularization parameter for the Anchor Regression

target_variable

is the target variable name contained in the x dataframe

Value

A list of predictions.

Examples

1
2
3
4
5
6
7
x <- as.data.frame(matrix(data = rnorm(100),nrow = 100,ncol = 10))
anchor <- as.data.frame(matrix(data = rnorm(200),nrow = 100,ncol = 2))
colnames(anchor) <- c('X1','X2')
gamma <- 2
target_variable <- 'V2'
anchor_model <- anchor_regression(x, anchor, gamma, target_variable)
anchor_prediction(anchor_model$model, x, anchor, gamma, target_variable)

simzim96/AnchorRegression documentation built on Jan. 28, 2021, 9:42 a.m.