predict.btsr {BTSR} | R Documentation |
Predict method for BTSR
Description
Predicted values based on btsr object.
Usage
## S3 method for class 'btsr'
predict(object, newdata, nnew = 0, debug = FALSE, ...)
Arguments
object |
Object of class inheriting from |
newdata |
A matrix with new values for the regressors. If omitted and
|
nnew |
number of out-of-sample forecasts required. If |
debug |
logical, if |
... |
further arguments passed to or from other methods. |
Details
predict.btsr
produces predicted values, obtained by evaluating the
regression function in the frame newdata
.
If newdata
is omitted the predictions are based on the data used for the
fit.
For now, prediction intervals are not provided.
Value
If nnew = 0
, returns a list with in-sample predictions (fitted.values
,
etat
and error
), otherwise, returns a list with the following arguments
-
fitted.values
: in-sample forecast.
If\nu_t
is fixed: a vector with the in-sample value of\mu_t
.
If\nu_t
is time varying: a matrix with the in-sample values of\mu_t
,\nu_t
and\vartheta_t
. -
etat
: the linear predictor(s)
For models with\nu
fixed, returns\eta_{1t} = g_{11}(\mu_t)
For models with time varying\nu
, returns a matrix whose columns are\eta_{1t} = g_{11}(\mu_t)
and\eta_{2t} = g_{21}(\vartheta_t)
. -
error
: the error terme_{1t}
(depends on the argumenterror.scale
) -
residual
: The (in-sample) residuals, that is, the observed valuesY_t
minus the fitted values\mu_t
. The same as theerror
term iferror.scale = 0
. -
forecast
: the out-of-sample forecast.
If\nu_t
is fixed: a vector with the predicted values for\mu_t
and\eta_{1t}
If\nu_t
is time varying: a matrix the predicted values for\mu_t
and\eta_{1t}
,\nu_t
,\vartheta_t
and\eta_{2t}
.
For BARC models also returs a column with predicted values for the iterated map. -
TS
: only for"BARC"
models. The iterated map. -
xnew
: out-of-sample values forxreg
(if presented). These are the values passed throughnewdata
.
Examples
#------------------------------------------------------------
# Generating a Beta model were mut does not vary with time
# yt ~ Beta(a,b), a = mu*nu, b = (1-mu)*nu
#------------------------------------------------------------
y <- btsr.sim(
model = "BARFIMA", linkg = "linear",
n = 100, coefs = list(alpha = 0.2, nu = 20)
)
# fitting the model
f <- btsr.fit(
model = "BARFIMA", yt = y, report = TRUE,
start = list(alpha = 0.5, nu = 10),
linkg = "linear", d = FALSE
)
pred <- predict(f, nnew = 5)
pred$forecast