| weighted_anchor_prediction {AnchorRegression} | R Documentation | 
weighted_anchor_regression
Description
Perform a prediction for a Weighted Anchor Regression model
Usage
weighted_anchor_prediction(names, coeff, x, anchor, gamma, target_variable)
Arguments
names | 
 list of variable names corresponding to the coefficients in coeff  | 
coeff | 
 list of coefficients corresponding to the coefficients in names  | 
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
   # number of observed environments
   environments <- 10
   # populate list with generated data of x and anchor
   data_x_list <- c()
   data_anchor_list <- c()
   for(e in 1:environments){
     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')
     data_x_list[[e]] <- x
     data_anchor_list[[e]]  <- anchor
   }
   # estimate model
   gamma <- 2
   target_variable <- 'V2'
   weighted_anchor_model <- weighted_anchor_regression(data_x_list,
                                                       data_anchor_list,
                                                       gamma,
                                                       target_variable,
                                                       anchor_model_pre=NULL,
                                                       test_split=0.4,
                                                       lambda=0)
   weighted_anchor_prediction(weighted_anchor_model$names,
                              weighted_anchor_model$coeff,
                              x,
                              anchor,
                              gamma,
                              target_variable)
[Package AnchorRegression version 0.1.3 Index]