PredictAdaptiveReg: Prediction of new values using the adaptive regression...

Description Usage Arguments Value Examples

View source: R/PredictAdaptiveReg.R

Description

This function predicts the values of the response variables associated to new observations of the explanatory variables.

Usage

1

Arguments

fit

An object containing a fitted model obtained by the AdaptiveReg function

xnew

A matrix with p columns containing the new observations of the explanatory variables.

Value

A vector containing the predicted values of the response variable.

Examples

1
2
3
4
5
6
7
8
library(prospectr)
data(NIRsoil)
indNA = which(is.na(NIRsoil$Nt))
NIRNt = list(x=NIRsoil$spc[-indNA,],y=NIRsoil$Nt[-indNA])
ind.test = sample(1:length(NIRNt$y),50)
fit = AdaptiveReg(NIRNt$x[-ind.test,],NIRNt$y[-ind.test],nvmax=100)
pred = PredictAdaptiveReg(fit,NIRNt$x[ind.test,])
plot(NIRNt$y[ind.test],pred,pch=16,xlab="Y",ylab=expression(hat(Y)))

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