Top |
void | free_fit_resid () |
FITRESID * | get_fit_resid () |
FITRESID * | get_forecast () |
FITRESID * | get_system_forecast () |
int | do_forecast () |
void | forecast_options_for_model () |
gretl_matrix * | get_forecast_matrix () |
FITRESID * | recursive_OLS_k_step_fcast () |
void | fcast_get_continuous_range () |
void | forecast_matrix_cleanup () |
void
free_fit_resid (FITRESID *fr
);
Frees all resources associated with fr
, then frees the pointer
itself.
FITRESID * get_fit_resid (const MODEL *pmod
,const DATASET *dset
,int *err
);
Allocates a FITRESID structure and fills it out with
the actual and predicted values of the dependent variable
in pmod
.
FITRESID * get_forecast (MODEL *pmod
,int t1
,int t2
,int pre_n
,DATASET *dset
,gretlopt opt
,int *err
);
Allocates a FITRESID structure and fills it out with forecasts
based on pmod
, over the specified range of observations.
For some sorts of models forecast standard errors are also
computed (these appear in the sderr
member of the structure
to which a pointer is returned; otherwise the sderr
member is
NULL
).
The calculation of forecast errors, where applicable, is based on Davidson and MacKinnon, Econometric Theory and Methods, chapter 3 (p. 104), which shows how the variance of forecast errors can be computed given the covariance matrix of the parameter estimates, provided the error term may be assumed to be serially uncorrelated.
pmod |
the model from which forecasts are wanted. |
|
t1 |
start of forecast range. |
|
t2 |
end of forecast range. |
|
pre_n |
number of pre-forecast observations to include. |
|
dset |
dataset struct. |
|
opt |
if |
|
err |
location to receive error code. |
pointer to allocated structure, or NULL
on failure,
in which case an error code is assigned via err
.
FITRESID * get_system_forecast (void *p
,int ci
,int i
,int t1
,int t2
,int pre_n
,DATASET *dset
,gretlopt opt
,int *err
);
Allocates a FITRESID structure and fills it out with forecasts
based on the system at location p
, over the specified range of
observations.
p |
pointer to the VAR or equation system from which forecasts are wanted. |
|
ci |
||
i |
0-based index for the variable to forecast, within the equation system. |
|
t1 |
start of forecast range. |
|
t2 |
end of forecast range. |
|
pre_n |
number of pre-forecast observations to include. |
|
dset |
dataset struct. |
|
opt |
if |
|
err |
location to receive error code. |
int do_forecast (const char *str
,DATASET *dset
,gretlopt opt
,PRN *prn
);
In the case of "simple" models with an autoregressive error term
(AR
, AR1
) the forecast values incorporate the predictable
component of the error.
str |
command string, which may include a starting observation and ending observation, and/or the name of a variable for saving the forecast values. |
|
dset |
dataset struct. |
|
opt |
if |
|
prn |
gretl printing struct. |
void forecast_options_for_model (MODEL *pmod
,const DATASET *dset
,FcastFlags *flags
,int *dt2max
,int *st2max
);
Examines pmod
and determines which forecasting options are
applicable.
pmod |
the model from which forecasts are wanted. |
|
dset |
dataset struct. |
|
flags |
location to receive flags from among FcastFlags. |
|
dt2max |
location to receive the last observation that can be supported for a dynamic forecast. |
|
st2max |
location to receive the last observation that can be supported for a static forecast. |
FITRESID * recursive_OLS_k_step_fcast (MODEL *pmod
,DATASET *dset
,int t1
,int t2
,int k
,int pre_n
,int *err
);
void fcast_get_continuous_range (const FITRESID *fr
,int *pt1
,int *pt2
);
struct FITRESID_ { int model_ID; /* ID of model on which forecast is based */ int asymp; /* 0/1 flag for asymptotic estimator */ int std; /* 0/1 flag for standardized residuals */ int model_t1; /* start of model estimation range */ int method; /* one of the ForecastMethod options */ double *actual; /* array of values of dependent variable */ double *fitted; /* array of fitted values */ double *resid; /* array of residuals */ double *sderr; /* array of forecast standard errors (or NULL) */ double sigma; /* standard error of regression */ double alpha; /* for confidence intervals */ int pmax; /* if positive, suggested number of decimal places for use in printing */ int df; /* degrees of freedom for model */ int t0; /* start of pre-forecast data range */ int t1; /* start of forecast range */ int t2; /* end of forecast range */ int k; /* number of steps ahead (method = FC_KSTEP only) */ int nobs; /* length of the arrays actual, fitted, resid */ char depvar[VNAMELEN]; /* name of dependent variable */ };