sumSqerror: Calculate sum of squared prediction errors

Description Usage Arguments Details Value See Also Examples

Description

Calculate a weighted sum squared prediction errors for a parameterization.

Usage

1
    sumSqerror(coefficients, model=NULL, data=NULL, error.weights=NULL)

Arguments

coefficients

A vector of coefficients (parameters).

model

an object of class TSmodel which gives the structure of the model for which coefficients are used. coef(model) should be the same length as coefficients.

data

an object of class TSdata which gives the data with which the model is to be evaluated.

error.weights

a vector of weights to be applied to the squared prediction errors.

Details

This function is primarily for use in parameter optimization, which requires that an objective function be specified by a vector of parameters.It returns only the sum of the weighted squared errors (eg.for optimization). The sample size is determined by TobsOutput(data).

Value

The value of the sum squared errors for a prediction horizon given by the length of error.weights. Each period ahead is weighted by the corresponding weight in error.weights.

See Also

l l.SS l.ARMA

Examples

1
2
3
4
data("eg1.DSE.data.diff", package="dse")
model <- estVARXls(eg1.DSE.data.diff)
sumSqerror(1e-10 + coef(model), model=TSmodel(model), 
        data=TSdata(model), error.weights=c(1,1,10))

Example output

Loading required package: tfplot
Loading required package: tframe

Attaching package:dseThe following objects are masked frompackage:stats:

    acf, simulate

[1] 6902.396

dse documentation built on March 26, 2020, 7:12 p.m.