cm_pllLOOCV: Parallel Leave one out cross validation

Description Usage Arguments Value Examples

View source: R/cm_pllLOOCV.R

Description

This function performs a parallelized LOOCV to evaluate the prediction accuracy of a linear regression whose parameter are computed through a Steepest descent algorithm. It always uses the maximum number of cores possible.

Usage

1
cm_pllLOOCV(y, X, b_pre, tol = 0.001, maxit = 1000)

Arguments

y

Response variable observations

X

Covariates Matrix: each column contains observations for each covariate.

tol

Tolerance level for the optimization process, the default is 0.001.

maxit

Maximum iterations number

b:

vector of initial parameters

Value

The mean squared error of prediction

Examples

1
2
3
4
5
6
7
8
set.seed(8675309)
n = 1000
x1 = rnorm(n)
x2 = rnorm(n)
y = 1 + .5*x1 + .2*x2 + rnorm(n)
X=cbind(x1,x2)
b_pre <- c(0,0,0)
cm_pllLOOCV(y, X, b_pre = c(0,0,0))

FedericoCortese/R4DScm documentation built on July 12, 2021, 5:30 a.m.