extractScale: Functions to extract scale and standard error from a model

View source: R/methods.R

extractScaleR Documentation

Functions to extract scale and standard error from a model

Description

Functions extract scale and the standard error of the residuals. Mainly needed for the work with the model estimated via sm.

Usage

extractScale(object, ...)

## Default S3 method:
extractScale(object, ...)

## S3 method for class 'greybox'
extractScale(object, ...)

extractSigma(object, ...)

## Default S3 method:
extractSigma(object, ...)

## S3 method for class 'greybox'
extractSigma(object, ...)

Arguments

object

The model estimated using lm / alm / etc.

...

Other parameters (currently nothing).

Details

In case of a simpler model, the functions will return the scalar using sigma() method. If the scale model was estimated, extractScale() and extractSigma() will return the conditional scale and the conditional standard error of the residuals respectively.

Value

One of the two is returned, depending on the type of estimated model:

  • Scalar from sigma() method if the variance is assumed to be constant.

  • Vector of values if the scale model was estimated

Author(s)

Ivan Svetunkov, ivan@svetunkov.com

See Also

sm

Examples

# Generate the data
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 and scale model
ourModel <- alm(y~., xreg, scale=~x1+x2)

# Extract scale
extractScale(ourModel)
# Extract standard error
extractSigma(ourModel)


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