bsubst {timsac} | R Documentation |
Produce Bayesian estimates of time series models such as pure AR models, AR models with non-linear terms, AR models with polynomial type mean value functions, etc. The goodness of fit of a model is checked by the analysis of several steps ahead prediction errors.
bsubst(y,mtype,lag=NULL,nreg,reg=NULL,term.lag=NULL,cstep=5,plot=TRUE)
y |
a univariate time series. |
mtype |
model type. Allowed values are
1 : (autoregressive model),
2 : (polinomial type non-linear model, lag's read in),
3 : (polinomial type non-linear model, lag's automatically set) and
4 : (AR-model with polinomial mean value function).
5 ,6 and 7 are originaly defined but omitted here. |
lag |
maximum time lag. Default is 2*sqrt(n), where n is the length of the time series y. |
nreg |
number of regressors. |
reg |
specification of regressor (mtype = 2).
i-th regressor is defined by z(n-L1(i)) * z(n-L2(i)) * z(n-L3(i)), where L1(i) is reg(1,i), L2(i) is reg(2,i) and L3(i) is reg(3,i). 0-lag term z(n-0) is replaced by the constant 1. |
term.lag |
maximum time lag specify the regressors (L1(i),L2(i),L3(i)) (i=1,...,nreg) (mtype = 3).
i-th regressor is defined by z(n-L1(i)) * z(n-L2(i)) * z(n-L3(i)), where 0-lag term z(n-0) is replaced by the constant 1. term.lag(1) : maximum time lag of linear term term.lag(2) : maximum time lag of squared term term.lag(3) : maximum time lag of quadratic cross term term.lag(4) : maximum time lag of cubic term term.lag(5) : maximum time lag of cubic cross term. |
cstep |
prediction errors checking (up to cstep-steps ahead) is requested. |
plot |
logical. If TRUE (default) daic, pre.err and peautcor are plotted. |
The AR model is given by (mtype = 2)
y(t) = a(1)y(t-1) + .... + a(p)y(t-p) + u(t).
The non-linear model is given by ( mtype = 2,3 )
y(t) = a(1)z(t,1) + a(2)z(t,2) +...+ a(p)z(t,p) + u(t).
Where p is AR order and u(t) is Gaussian white noise with mean 0 and variance v(p).
ymean |
mean of y. |
yvar |
variance of y. |
v |
innovation variance. |
aic |
AIC(m), (m=0,...,nreg). |
aicmin |
minimum AIC. |
daic |
AIC(m)-aicmin (m=0,...,nreg). |
order.maice |
order of minimum AIC. |
v.maice |
innovation variance attained at order.maice. |
arcoef.maice |
AR coefficients attained at order.maice. |
v.bay |
residual variance of Bayesian model. |
aic.bay |
AIC of Bayesian model. |
np.bay |
equivalent number of parameters. |
arcoef.bay |
AR coefficients of Bayesian model. |
ind.c |
index of parcor2 in order of increasing magnitude. |
parcor2 |
square of partial correlations (normalisedby multiplying N). |
damp |
binomial type damper. |
bweight |
final Bayesian weights of partial correlations. |
parcor.bay |
partial correlations of the Bayesian model. |
eicmin |
minimum EIC. |
esum |
whole subset regression models. |
npmean |
mean of number of parameter. |
npmean.nreg |
(=npmean/nreg). |
perr |
prediction error. |
mean |
mean. |
var |
variance. |
skew |
skewness. |
peak |
peakedness. |
peautcor |
autocorrelation function of 1-step ahead prediction error. |
pspec |
power spectrum (mtype = 1). |
H.Akaike, G.Kitagawa, E.Arahata and F.Tada (1979) Computer Science Monograph, No.11, Timsac78. The Institute of Statistical Mathematics.
data(Canadianlynx) Regressor <- matrix(c( 1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0, 6, 0, 0, 7, 0, 0, 8, 0, 0, 9, 0, 0, 10, 0, 0, 11, 0, 0, 12, 0, 0, 1, 1, 0, 2, 2, 0, 1, 2, 0, 3, 3, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3 ), 3,19) z <- bsubst(Canadianlynx, mtype=2, lag=12, nreg=19, reg=Regressor, cstep=5 ) z$arcoef.bay