Learn R Programming

dse (version 2020.2-1)

scale.TSdata: Scale Methods for TS objects

Description

Scale data or a model by a given factor.

Usage

# S3 method for TSdata
scale(x, center=FALSE, scale=NULL)
    # S3 method for TSestModel
scale(x, center=FALSE, scale=NULL)
    # S3 method for ARMA
scale(x, center=FALSE, scale=NULL)
    # S3 method for innov
scale(x, center=FALSE, scale=NULL)
    # S3 method for nonInnov
scale(x, center=FALSE, scale=NULL)
    
    checkScale(x, scale)
    # S3 method for TSestModel
checkScale(x, scale)
    # S3 method for TSmodel
checkScale(x, scale)

Arguments

x

TSdata, TSmodel or an object containing these.

center

to match generic arguments, not currently used.

scale

A list with two matrices or vectors, named input and output, giving the multiplication factor for inputs and outputs. Vectors are treated as diagonal matrices. scale$input can be NULL if no transformation is to be applied (or the data or model has no input.)

Value

The resulting data or model is different from the original in proportion to scale. ie. if S and T are output and input scaling matrices then y'(t) = S y(t) where y' is the new output u'(t) = S u(t) where u' is the new input

For models the result has inputs and outputs (and innovations) which are scaled as if data scaling had been applied to them as above. Thus if the input and output scales are diagonal matrices or scalars the plot of the predictions and residuals for l(scale(model,scale=somescale), scale(data, scale=somescale)) while have the same appearance as l(model, data) but will be scaled differently.

See Also

scale

Examples

Run this code
# NOT RUN {
    data("eg1.DSE.data.diff", package="dse")
    # This is a simple example. Usually scale would have something 
    # to do with the magnitude of the data.
    z <- scale(eg1.DSE.data.diff, 
        scale=list(input=rep(2, nseriesInput(eg1.DSE.data.diff)), 
                  output=rep(2,nseriesOutput(eg1.DSE.data.diff))))
    model <- estVARXls(eg1.DSE.data.diff)
    model <- scale(model, 
        scale=list(input=rep(2, nseriesInput(eg1.DSE.data.diff)), 
                  output=rep(2,nseriesOutput(eg1.DSE.data.diff))))
# }

Run the code above in your browser using DataLab