powered by
Function which runs a linear regression on a training set, computes predictions for the test set
get_predictions_lin(trset,testset,outc,k,n_tr,p,Rsq,Rsq_v,marg)
An array of continous variables of the length equal to the size of a testset
testset
values of predictors on the training set
values of predictors on the test set
length of the test set
size of the training set
weight of the model
whether the R-squared statistics constraint is introduced
value of R-squared statistics on the training spli of the data
margin of error for R-squared statistics constraint
Function uses function lsfit and coef
lsfit
coef
trset<-matrix(c(rnorm(90,2,4),runif(90,0,0.5),rbinom(90,1,0.5)),ncol=3) testset<-matrix(c(rnorm(10,2,4),runif(10,0,0.5),rbinom(10,1,0.5)),ncol=3) get_predictions_lin(trset,testset,runif(90,0,1),10)
Run the code above in your browser using DataLab