anchor_regression_gam: anchor_regression_gam

Description Usage Arguments Value Examples

Description

Perform an Generalized Additive Anchor Regression

Usage

1
2
3
4
5
6
7
8
anchor_regression_gam(
  x,
  anchor,
  gamma,
  target_variable,
  bin_factor = NULL,
  force_binary = TRUE
)

Arguments

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

bin_factor

factor variable that can be transformed to a factor to partial out effects

force_binary

if set to TRUE forces bin_factor to be binary

Value

A list with coefficient values and a list with the respective names overview_print. Additionally the transformed data as x and y plus the fixed lambda coefficient.

Examples

1
2
3
4
5
6
7
x <- as.data.frame(matrix(data = rnorm(10000),nrow = 1000,ncol = 10))
x$bin <- sample(nrow(x),x = c(1,0),prob = c(0.5,0.5),replace = TRUE)
anchor <- as.data.frame(matrix(data = rnorm(2000),nrow = 1000,ncol = 2))
colnames(anchor) <- c('X1','X2')
gamma <- 2
target_variable <- 'V2'
anchor_regression_gam(x, anchor, gamma, target_variable,bin_factor =  "bin")

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