swReg.xval: Get k-fold cross validated predictions for a given swReg...

Description Usage Arguments Value Examples

Description

swReg.xval returns cross validated predictions for the swReg model specified.

Usage

1
swReg.xval(object, k = 10)

Arguments

object

an R object resulting from application of swReg

k

integer. Number of folds to be used.

Value

A list with iteration numbers on the x-axis and coefficient values on the y-axis,

Examples

1
2
3
4
5
6
7
## Example using Boston Housing data:
 library(MASS)
 X <- as.matrix(Boston[,-14])
 Y <- Boston$medv
 swReg2 <- swReg(X, Y, stepsize = .01)
 xval2 <- swReg.xval(swReg2)
 mean(xval2$error^2) # MSE

marjoleinF/swReg documentation built on May 21, 2019, 11:47 a.m.