implant: Implant the scale model in the location model

View source: R/scaler.R

implantR Documentation

Implant the scale model in the location model

Description

The function implants the scale model into the location model. It currently works with alm / adam and sm() method.

Usage

implant(location, scale, ...)

Arguments

location

Model estimated using either alm or adam.

scale

The scale model, estimate with sm method.

...

Currently nothing. Implemented for flexibility.

Details

The function is needed in order to treat the scale of model correctly in the methods like forecast().

Value

The model of the same class as the location model, but with scale from the estimated model via sm(). This is needed to produce appropriate forecasts in case of scale model and to take into account the correct number of estimated parameters.

Author(s)

Ivan Svetunkov, ivan@svetunkov.com

See Also

alm, adam, sm

Examples


xreg <- cbind(rnorm(100,10,3),rnorm(100,50,5))
xreg <- cbind(100+0.5*xreg[,1]-0.75*xreg[,2]+sqrt(exp(0.8+0.2*xreg[,1]))*rnorm(100,0,1),
              xreg,rnorm(100,300,10))
colnames(xreg) <- c("y","x1","x2","Noise")

# Estimate the location model
ourModel <- alm(y~.,xreg)
# Estimate the scale model
ourScale <- sm(ourModel,formula=~x1+x2)
# Implant scale into location
ourModel <- implant(ourModel, ourScale)


config-i1/greybox documentation built on Dec. 12, 2024, 1:42 p.m.