I try to estimate a component sGarch model with the rugarch package in R. My goal is to extract the short-run and long-run volatility components of any time series. I am not interested in the coefficients.

Does someone here know how I get such an output?

I know that sigma(fitted model) is giving me $\sigma^2_t$ but I cannot get an output for $q_t$. If I use uncvariance(fitted model), it is just giving a single number.

Thanks in advance!

Here is some code:

# With an arbitrary data input, here I used some spot rate data

garchspec <- ugarchspec(variance.model = list(model = "csGARCH", garchOrder = c(1,1)))

garchfit <- ugarchfit(garchspec, SpotRates)


sig <- sigma(garchfit)
sig2 <- uncvariance(garchfit)

And a description of the model (taken from 'Introduction to the rugarch_package'):

enter image description here


It is not impossible that the authors of the package did not include this option.

In that case, if you know how they initialize their filtering, you can just recuperate what they do give you (parameters, conditional variance, mean equation residuals) and filter out your series for $q_t$ recursively yourself. Here is how you control the initialization for the estimation in the package:

The option rec.init, introduced in version 1.0-14 allows to set the 
type of method for the conditional recursion initialization, with 
default value ’all’ indicating that all the data is used to calculate 
the mean of the squared residuals from the conditional mean 
filtration. To use the first ’n’ points for the calculation, a 
positive integer greater than or equal to one (and less than the total 
estimation datapoints) can instead be provided. If instead a positive 
numeric value less than 1 is provided, this is taken as the weighting 
in an exponential smoothing backcast method for calculating the 
initial recursion value.

Once you picked an option, even if the package doesn't allow you to obtain the filtered series you want, you can always recompute things recursively yourself using what they do give you.

Yes, it's stupid and a waste because they already computed it elsewhere... but, oh well.

| improve this answer | |

OP here. I wrote an E-Mail to the package author and he gave me a tip. To help more people, I post a solution here:

garchspec <- ugarchspec(any spec)

garchfit <- ugarchfit(any fit)

q_t <- garchfit@fit$q

Thanks @Stéphane for Input!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.