Learn R Programming

gets (version 0.38)

coef.gets: Extraction functions for 'gets' objects

Description

Extraction functions for objects of class 'gets'

Usage

# S3 method for gets
coef(object, spec=NULL, ...)
  # S3 method for gets
fitted(object, spec=NULL, ...)
  # S3 method for gets
logLik(object, ...)
  # S3 method for gets
plot(x, spec=NULL, col=c("red","blue"),
    lty=c("solid","solid"), lwd=c(1,1), ...)
  # S3 method for gets
predict(object, spec=NULL, n.ahead=12, newmxreg=NULL,
    newvxreg=NULL, newindex=NULL, n.sim=5000, innov=NULL, probs=NULL,
    ci.levels=NULL, quantile.type=7, return=TRUE, verbose=FALSE, plot=NULL,
    plot.options=list(), ...)
  # S3 method for gets
print(x, signif.stars=TRUE, ...)
  # S3 method for gets
residuals(object, std=NULL, ...)
  # S3 method for gets
sigma(object, ...)
  # S3 method for gets
summary(object, ...)
  # S3 method for gets
vcov(object, spec=NULL, ...)

Value

coef:

a numeric vector containing parameter estimates

fitted:

a zoo object with fitted values

logLik:

a numeric, the log-likelihood (normal density)

plot:

a plot of the fitted values and the residuals

predict:

a vector of class zoo containing the out-of-sample forecasts, or a matrix of class zoo containing the out-of-sample forecasts together with prediction-quantiles, or - if return=FALSE - NULL

print:

a print of the estimation results

residuals:

a zoo object with the residuals

sigma:

the regression standard error ('SE of regression')

summary:

a print of the items in the gets object

vcov:

a variance-covariance matrix

Arguments

object

an object of class 'gets'

x

an object of class 'gets'

spec

NULL, "mean", "variance" or, in some instances, "both". When NULL is a valid value, then it is automatically determined whether information pertaining to the mean or variance specification should be returned

signif.stars

logical. If TRUE, then p-values are additionally encoded visually, see printCoefmat

std

logical. If FALSE (default), then the mean residuals are returned. If TRUE, then the standardised residuals are returned

n.ahead

integer that determines how many steps ahead predictions should be generated (the default is 12)

newmxreg

a matrix of n.ahead rows and NCOL(mxreg) columns with the out-of-sample values of the mxreg regressors

newvxreg

a matrix of n.ahead rows and NCOL(vxreg) columns with the out-of-sample values of the vxreg regressors

newindex

NULL (default) or the date-index for the zoo object returned by predict.arx. If NULL, then the function uses the in-sample index to generate the out-of-sample index

n.sim

integer, the number of replications used for the generation of the forecasts

innov

NULL (default) or a vector of length n.ahead * n.sim containing the standardised errors (that is, zero mean and unit variance) used for the forecast simulations. If NULL, then a classica bootstrap procedure is used to draw from the standardised in-sample residuals

probs

NULL (default) or a vector with the quantile-levels (values strictly between 0 and 1) of the forecast distribution. If NULL, then no quantiles are returned unless ci.levels is non-NULL

ci.levels

NULL (default) or a vector with the confidence levels (expressed as values strictly between 0 and 1) of the forecast distribution. The upper and lower values of the confidence interval(s) are returned as quantiles

quantile.type

an integer between 1 and 9 that selects which algorithm to be used in computing the quantiles, see the argument type in quantile

return

logical. If TRUE (default), then the out-of-sample predictions are returned. The value FALSE, which does not return the predictions, may be of interest if only a prediction plot is of interest

verbose

logical with default FALSE. If TRUE, then additional information (typically the quantiles and/or the simulated series) used in the generation of forecasts is returned. If FALSE, then only the forecasts are returned

plot

NULL (default) or logical. If NULL, then the value set by options$plot (see options) determines whether a plot is produced or not. If TRUE, then the out-of-sample forecasts are plotted.

plot.options

a list of options related to the plotting of forecasts, see 'Details'

col

colours of fitted (default=red) and actual (default=blue) lines

lty

types of fitted (default=solid) and actual (default=solid) lines

lwd

widths of fitted (default=1) and actual (default=1) lines

...

additional arguments

Details

The plot.options argument is a list that controls the prediction plot, see 'Details' in predict.arx

See Also

getsm, getsv, isat

Examples

Run this code
##Simulate from an AR(1):
set.seed(123)
y <- arima.sim(list(ar=0.4), 100)

##Simulate four independent Gaussian regressors:
xregs <- matrix(rnorm(4*100), 100, 4)

##estimate an AR(2) with intercept and four conditioning
##regressors in the mean, and a log-ARCH(3) in the variance:
mymod <- arx(y, mc=TRUE, ar=1:2, mxreg=xregs, arch=1:3)

##General-to-Specific (GETS) model selection of the mean:
meanmod <- getsm(mymod)

##General-to-Specific (GETS) model selection of the variance:
varmod <- getsv(mymod)

##print results:
print(meanmod)
print(varmod)

##plot the fitted vs. actual values, and the residuals:
plot(meanmod)
plot(varmod)

##generate and plot predictions of the mean:
predict(meanmod, plot=TRUE)

##print the entries of object 'gets':
summary(meanmod)
summary(varmod)

##extract coefficients of the simplified (specific) model:
coef(meanmod) #mean spec
coef(varmod) #variance spec

##extract log-likelihood:
logLik(mymod)

##extract coefficient-covariance matrix of simplified
##(specific) model:
vcov(meanmod) #mean spec
vcov(varmod) #variance spec

##extract and plot the fitted values:
mfit <- fitted(meanmod) #mean fit
plot(mfit)
vfit <- fitted(varmod) #variance fit
plot(vfit)

##extract and plot residuals:
epshat <- residuals(meanmod)
plot(epshat)

##extract and plot standardised residuals:
zhat <- residuals(varmod)
plot(zhat)

Run the code above in your browser using DataLab