AdaptiveReg: Regression predictor based on an adaptive handling of...

Description Usage Arguments Value Examples

View source: R/AdaptiveReg.R

Description

This function constructs a predictor for regression problems using an adaptive handling of dependence. Dependence handling is controlled by the number of eigenvectors of the correlation matrix of the explanatory variables. The number of eigenvectors is selected using a cross-validation procedure maximizing the R^2.

Usage

1
AdaptiveReg(x, y, nvmax = NULL, nfolds = 10)

Arguments

x

A matrix of size n x p containing the observations of the explanatory variables

y

A real-valued vector of length n containing the observations of the response

nvmax

An integer giving the maximum number of latent factors to take to construct the prediction rule. By default (NULL), the function takes as many as possible.

nfolds

The number of folds to use to perform the cross-validation for the selection of the number of eigenvectors. Must be between 3 and n (for leave-one-out cross-validation). Default = 10.

Value

A list containing the following elements:

ZgMoments

A list containing several elements related to the moments of the latent variables involved in the calculation of the predictor

nv

The optimal number of eigenvectors

R2

The vector of values of the cross-validation R^2 (one value for each possible number of eigenvectors).

Examples

1
2
3
4
5
library(prospectr)
data(NIRsoil)
indNA = which(is.na(NIRsoil$Nt))
NIRNt = list(x=NIRsoil$spc[-indNA,],y=NIRsoil$Nt[-indNA])
fit = AdaptiveReg(NIRNt$x,NIRNt$y,nvmax=100) #100 latent factors at most

fhebert/AdaptivePrediction documentation built on Nov. 4, 2019, 12:40 p.m.