# NOT RUN {
environments <- 10 # number of observed environments
# 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_regression(data_x_list,
data_anchor_list,
gamma,
target_variable,
anchor_model_pre=NULL,
test_split=0.4,
lambda=0)
# }
Run the code above in your browser using DataLab