Description Usage Arguments Details Value Author(s) See Also Examples
Estimate the prediction error of a previously fit sequential regression model such as a robust least angle regression model or a sparse least trimmed squares regression model.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 
object 
the model fit for which to estimate the prediction error. 
splits 
an object of class 
cost 
a cost function measuring prediction loss. It should expect
vectors to be passed as its first two arguments, the first corresponding to
the observed values of the response and the second to the predicted values,
and must return a nonnegative scalar value. The default is to use the root
mean squared prediction error for nonrobust models and the root trimmed
mean squared prediction error for robust models (see

ncores 
a positive integer giving the number of processor cores to be
used for parallel computing (the default is 1 for no parallelization). If
this is set to 
cl 
a parallel cluster for parallel computing as generated by

seed 
optional initial seed for the random number generator (see

... 
additional arguments to be passed to the prediction loss
function 
fit 
a character string specifying for which fit to estimate the
prediction error. Possible values are 
The prediction error can be estimated via (repeated) Kfold crossvalidation, (repeated) random splitting (also known as random subsampling or Monte Carlo crossvalidation), or the bootstrap. In each iteration, the optimal model is thereby selected from the training data and used to make predictions for the test data.
An object of class "perry"
with the following components:
pe
a numeric vector containing the estimated prediction errors for the requested model fits. In case of more than one replication, this gives the average value over all replications.
se
a numeric vector containing the estimated standard errors of the prediction loss for the requested model fits.
reps
a numeric matrix in which each column contains the estimated prediction errors from all replications for the requested model fits. This is only returned in case of more than one replication.
splits
an object giving the data splits used to estimate the prediction error.
y
the response.
yHat
a list containing the predicted values from all replications.
call
the matched function call.
Andreas Alfons
rlars
, sparseLTS
,
predict
, perry
,
cost
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26  ## generate data
# example is not highdimensional to keep computation time low
library("mvtnorm")
set.seed(1234) # for reproducibility
n < 100 # number of observations
p < 25 # number of variables
beta < rep.int(c(1, 0), c(5, p5)) # coefficients
sigma < 0.5 # controls signaltonoise ratio
epsilon < 0.1 # contamination level
Sigma < 0.5^t(sapply(1:p, function(i, j) abs(ij), 1:p))
x < rmvnorm(n, sigma=Sigma) # predictor matrix
e < rnorm(n) # error terms
i < 1:ceiling(epsilon*n) # observations to be contaminated
e[i] < e[i] + 5 # vertical outliers
y < c(x %*% beta + sigma * e) # response
x[i,] < x[i,] + 5 # bad leverage points
## fit and evaluate robust LARS model
fitRlars < rlars(x, y, sMax = 10)
perry(fitRlars)
## fit and evaluate sparse LTS model
frac < seq(0.2, 0.05, by = 0.05)
fitSparseLTS < sparseLTS(x, y, lambda = frac, mode = "fraction")
perry(fitSparseLTS)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.