Library: | times |
See also: | msarimaconvert msarimamodel |
Quantlet: | msarimacond | |
Description: | calculates the sum of squares of an ARMA(p,q) model and some diagnostics. Thereby, the model is conditioned on the first p observations of y and the first q residuals are set to 0. |
Usage: | {S,dia} = msarimacond(y,phiconv,thetaconv,mu {,k}) | |
Input: | ||
y | T x 1 vector of observed (stationary) time series | |
phiconv | (p + 1) x 1 vector with the coefficients of the AR polynomial, first entry must be 1 | |
thetaconv | (q + 1) x 1 vector with the coefficients of the MA polynomial, first entry must be 1 | |
mu | scalar value of the constant in the ARMA model | |
k | optional scalar, that gives the number of coefficients from the original model if the model is in expanded form. | |
Output: | ||
S | Sum of squares | |
dia | list with the following entries: the variance of the residuals (s2), the coefficient of determination (R2), the adjusted R2 (aR2), the value of the log likelihood function (logl), the Akaike information criteria (AIC), the Schwarz information criteria (SIC) and the series of the residuals (a). You retrieve the different elements by extending the list name with ".'name given in braces'". |
phiconv(B) y_t = mu + thetaconv(B) a_t
where B denotes the backshift (or lag) operator. Note that the first entries of phiconv and thetaconv are equal to 1. The residual sum of squares is just:
S = sum (phiconv(B) y_t - mu - theta(B) a_t)^2
where theta(B) is thetaconv(B) without the first entry. Furthermore, the output delivers a list with some diagnostics. If the model is in expanded form and the original model has k coefficients, then the diagnostics can be calculated with the number of the original coefficients.
library("times") ; loads the quantlets from library times G = read("airline") ; loads the airline data arma = list(0,1,-0.3776) ; list with coefficient for MA(1) part season = list(12,0,1,-0.5728) ; list with coefficient for seasonal MA part msarimamodelOut = msarimamodel((1|1),arma,season) ; sets the model {y,phiconv,thetaconv,k}= msarimaconvert(log(G),msarimamodelOut) ; expands the model mu = mean(y) {S,dia} = msarimacond(y,phiconv,thetaconv,mu,k) ; calculates the conditional sum of squares S dia.s2 ; variance of the residuals dia.R2 ; coefficient of determination dia.aR2 ; adjusted R2 dia.logl ; value of the log likelihood function dia.AIC ; Akaike information criteria dia.SIC ; Schwarz information criteria
Sum of squares and diagnostics calculated for the Box and Jenkins airline model. Coefficients are theta_1 = -0.3776 and theta_s,1 = -0.5728. Contents of S [1,] 0.18191 Contents of s2 [1,] 0.0014101 Contents of R2 [1,] 0.33433 Contents of aR2 [1,] 0.32917 Contents of logl [1,] 245.07 Contents of AIC [1,] -3.711 Contents of SIC [1,] -3.6672