cp: Calculate Mallows Cp Statistic for Linear Operator

Description Usage Arguments Details Value Author(s) References Examples

Description

Calculates Mallows Cp statistic for linear operators such as loess and the STL time series modeling method.

Usage

1
2
3
4
5
6
## S3 method for class 'op'
cp(object, y, sigmasq = 1)
## S3 method for class 'stlop'
cp(object, y, sigmasq = 1)
## S3 method for class 'loess'
cp(object, y, sigmasq = 1)

Arguments

object

objects of class "op" or "stlop", or "loess" which provide information from which the Cp statistic is calculated. If an ARMA model was included in the "stlop" object, this will be used.

y

the data that the operator is to be applied to.

sigmasq

an unbiased estimate of the residual variance.

Details

The Cp statistic is calculated as

M = RSS/sigmahat^2 - tr(Lambda) + nu

where RSS is the residual sum of squares, sigmahat^2 is the estimated residual variance of an unbiased model, Lambda is the regulator matrix (I - L)'(I-L), and nu is tr(L).

If an unbiased estimate of the residual variance is not known, the function can be called with default sigmasq = 1 and then Cp can be reconstructed using the output of the function.

Value

A data frame consisting of the smoother degrees of freedom df, which is nu in the above equation, the Cp statistic cp, the estimated residual standard deviation sigmahat as sigmahat, the trace of the regulator matrix, tr(Lambda) as delta1, and the residual sum of squares.

Author(s)

Ryan Hafen

References

W. S. Cleveland and S. J. Devlin. Locally weighted regression: An approach to regression analysis by local fitting. Journal of the American Statistical Association, 83(403):596–610, 1988.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
n <- 500
x <- c(1:n)
set.seed(2456)
y <- sin(x/100) + rnorm(n, sd=0.5)

cpres <- NULL
for(sp in seq(251, 351, by=5)) {
   ll <- loess(y ~ x, degree=2, span=sp/n)
   cpres <- rbind(cpres,
      cp(ll, sigmasq=0.5^2)
   )
}

xyplot(cp ~ df, data=cpres)

hafen/operator documentation built on May 17, 2019, 2:23 p.m.