accurate: Accurate Computation

View source: R/accurate.R

accurateR Documentation

Accurate Computation

Description

Computes the accurate criterion of smoothed (fitted) values.

Usage

accurate(x, x.hat, k, output = TRUE)

Arguments

x

a numeric vector of original values.

x.hat

a numeric vector of smoothed (fitted) values.

k

the number of parameters in obtaining the smoothed (fitted) values.

output

a logical value indicating to print the results in R console. The default is TRUE.

Details

See http://www.dms.umontreal.ca/~duchesne/chap12.pdf in page 616 - 617 for the details of calculations for each criterion.

Value

A vector containing the following components:

SST

the total sum of squares.

SSE

the sum of the squared residuals.

MSE

the mean squared error.

RMSE

the root mean square error.

MAPE

the mean absolute percent error.

MPE

the mean percent error.

MAE

the mean absolute error.

ME

the mean error.

R.squared

R^2 = 1 - SSE/SST.

R.adj.squared

the adjusted R^2.

RW.R.squared

the random walk R^2.

AIC

the Akaike's information criterion.

SBC

the Schwarz's Bayesian criterion.

APC

the Amemiya's prediction criterion

Note

If the model fits the series badly, the model error sum of squares SSE may be larger than SST and the R.squared or RW.R.squared statistics will be negative. The RW.R.squared uses the random walk model for the purpose of comparison.

Author(s)

Debin Qiu

Examples

X <- matrix(rnorm(200),100,2)
y <- 0.1*X[,1] + 2*X[,2] + rnorm(100)
y.hat <- fitted(lm(y ~ X))
accurate(y,y.hat,2)

aTSA documentation built on May 29, 2024, 8:50 a.m.