# How to manually find ARMA-GARCH residuals in R? [closed]

Let's say the data input is called data, which is in the form of a financial time series that will be fitted into an ARMA-GARCH model. The GARCH(1,1) is used because it is the best fit for a financial time series with volatility and heteroscedasticity.

Using ugarchfit and ugarchspec (comparing the BIC values) I found that the best fit is ARMA(2,1)GARCH(1,1) with parameters

mu = -0.322925157,ar1= 1.904752272, ar2= -0.918770379, ma1=-0.924142232, omega= 0.004355971, alpha1= 0.198723766,shape= 6.520216307, beta1 =0.713514758

Another method of fitting was to look at the acf and pacf of the data and instinctively find a good match, which is ARMA(1,0)GARCH(1,1) with parameters

mu = -0.453529886,ar1= 0.933776546, omega= 0.006608471, alpha1= 0.257053963,shape= 6.533376243, beta1 =0.622149898

I'm wondering how can I achieve the residuals from fitting data to each of these models and parameters. I tried using ugarchpath to input the parameters and each time I generate it comes up with a different model.

So, what I'm asking is what code or function can I use to find the residual manually? Because with the function resid, it gives the result from the first model ARMA(2,1)GARCH(1,1) because of the lowest BIC value. How can I get it from the ARMA(1,0)GARCH(1,1)?

## closed as off-topic by Richard Hardy, kjetil b halvorsen, Peter Flom♦Nov 7 '18 at 12:27

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Richard Hardy, kjetil b halvorsen, Peter Flom
If this question can be reworded to fit the rules in the help center, please edit the question.

• There are two kinds of residuals, standardized and nonstandardized. If resid does not give you the ones you want, perhaps there is an option in the function allowing to choose between the two and you can adjust it? Alternatively, look at the slots of the fitted model, residuals must be hiding in there (resid only extracts them from there). Use slotNames to learn what slots there are in the fitted model object. Within the specific slots, use names to learn what is in them. – Richard Hardy Nov 7 '18 at 7:20