# Extract the short-run and long-run volatility of any time series with component sGarch (rugarch)

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.

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)

print(garchfit)

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


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

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
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.

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!