| extractScale | R Documentation |
Functions extract scale and the standard error of the residuals. Mainly needed for the work with the model estimated via sm.
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, ...)
object |
The model estimated using lm / alm / etc. |
... |
Other parameters (currently nothing). |
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.
The scale follows the ADAM monograph: it is the variance \sigma^2 for the
distributions built on the Normal one (dnorm, dlnorm, dbcnorm,
dlogitnorm, dfnorm and drectnorm), so that extractSigma()
returns its square root in these cases.
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
Ivan Svetunkov, ivan@svetunkov.com
sm
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.