Variance of a Time Series Fitted to an ARIMA Model - r

I think this is a basic question, but maybe I am confusing the concepts.
Suppose I fit an ARIMA model to a time series using, for example, the function auto.arima() in the R forecast package. The model assumes constant variance. How do I obtain that variance? Is it the variance of the residuals?
If I use the model for forecasting, I know that it gives me the conditional mean. I'd like to know the (constant) variance as well.
Thank you.
Bruno

from the arima() help I see
sigma2
the MLE of the innovations variance.
var.coef
the estimated variance matrix of the
coefficients coef, which can be extracted
by the vcov method.
It seems like which you want will depend on your model. I am pretty sure you want sigma2.
to get the sigma2 do:
?arima
x=cumsum(rcauchy(1000))
aax=auto.arima(x)
str(aax)
aax$sigma2

Related

Subject specific prediction from heterogenous linear mixed effect model package (lcmm)

I am fitting a heterogeneous linear mixed effect model which is in the lcmm package in R. Currently, I am only getting the class-specific and weighted subject-specific prediction from the predictY function. But, I want a subject-specific prediction. Is there any way to construct a subject-specific prediction from this package? Any help is appreciated.
I have found the answer. Looks like PredictY gives the mean class-specific predictions and adding them with the multiplication of the random effects from each subject (ranef(model)) and the model design matrix for the random part will provide the subject-specific prediction.

DCC Multivariate GARCH estimation

I'm using 3 stocks (GSPC, STOXX50E and NIKKEI) in order to try to estimate a DCC Garch model.
Usual steps: get the returns of the series, start with a univariate GARCH model and replicate it (...)
Everything seems to work well until I get to the stage that my dccfit() retrieves me an output "incomplete". I need, in the end, to get estimates enough to build 6 equations (one equation for the variance of GSPC, for the variance of STOXX50E, for the variance of NIKKEI, for covariance between GSPC and STOXX50E, for covariance between STOXX50E and NIKKEI and covariance between GSPC and NIKKEI). Please see my outputs below:
After using print(dccfit), the output is ar1, ma1, omega, alpha1, beta1 for each time series. And in the end joint dcca1 and also joint dccb1.
enter image description here
Where are the other estimates for me to put in the equation? It seems that I can only estimate a univariate model...
What these estimates (alpha,omega,...) stand for? Variance? Mean?... If so, isn't it only a univariate estimation?
And the jointdcca1 and jointdccb1? Are they relevant for any equation?
Thanks a lot in advance for your attention.
The DCC model is a 2-step estimation procedure (2-step QMLE).
In the first step, you fit univariate models.
The alpha, omega etc. that you mentioned in your Question 1. are these parameter estimates.
In the second step, you estimate the additional parameters a,b of the matrix Q_t, derived from the decomposition of the conditional correlation matrix R_t, which in turn was obtained by the decomposition of H_t = D_t R_t D_t.

Does auto.arima function in R do the differencing for the y- and x-variables before or after estimating the linear regression model?

I'm trying to estimate a linear regression with arima errors, but my regressors are highly collinear and thus the regression model suffers from multicollinearity. Since my ultimate goal is to be able to interpret the individual regression coefficients as elasticities and to use them for ex-ante forecasting, I need to solve the multicollinearity somehow to be able to trust the coefficients of the regressors. I know that transforming the regressor variables eg. by differencing might help to reduce the multicollinearity. And I have also understood that auto.arima performs the same differencing for both the response variable as well as the regressors defined in xreg (see: Do we need to do differencing of exogenous variables before passing to xreg argument of Arima() in R?).
So my question is, does it do the transformation already before estimating the regression coefficients or is the regression estimated using the untransformed data and transformation done only before fitting the arima model to the errors? And if the transformation is done before estimating the regression, what is the script to get those transformed values to a table or something, to be able to run the multicollinearity test on those rather than the original data?
The auto.arima() function will do the differencing before estimation to ensure consistent estimators. The estimation of the regression coefficients and ARIMA model is done simultaneously using MLE.
You can manually difference the data yourself using the diff() function.

How to extract R squared from an ARIMA model

Is it possible to calculate an R squared value from an ARIMA model in R?
This is the output given from summary(model)
edit: I am worried about the biases associated with MAPE and other percentage errors. The quantities I'm predicting are relatively small so I feel that finding R2, correlation or some sort of other metric might be a better indicator.
Once you have ARMA errors, it is not a simple linear regression any more.

Can I test autocorrelation from the generalized least squares model?

I am trying to use a generalized least square model (gls in R) on my panel data to deal with autocorrelation problem.
I do not want to have any lags for any variables.
I am trying to use Durbin-Watson test (dwtest in R) to check the autocorrelation problem from my generalized least square model (gls).
However, I find that the dwtest is not applicable over gls function while it is applicable to other functions such as lm.
Is there a way to check the autocorrelation problem from my gls model?
Durbin-Watson test is designed to check for presence of autocorrelation in standard least-squares models (such as one fitted by lm). If autocorrelation is detected, one can then capture it explicitly in the model using, for example, generalized least squares (gls in R). My understanding is that Durbin-Watson is not appropriate to then test for "goodness of fit" in the resulting models, as gls residuals may no longer follow the same distribution as residuals from the standard lm model. (Somebody with deeper knowledge of statistics should correct me, if I'm wrong).
With that said, function durbinWatsonTest from the car package will accept arbitrary residuals and return the associated test statistic. You can therefore do something like this:
v <- gls( ... )$residuals
attr(v,"std") <- NULL # get rid of the additional attribute
car::durbinWatsonTest( v )
Note that durbinWatsonTest will compute p-values only for lm models (likely due to the considerations described above), but you can estimate them empirically by permuting your data / residuals.

Resources