# Doubt residuals/errors Model MA

Good morning, in the lesson about MA models in the time series course, I have a question that I haven't been able to resolve and I would appreciate it if you could shed some light on it for me. I understand that a MA model, to simplify, I will say it's of lag 1 MA(1) --> yt = k + Theta * et-1 My question is, I don't know how to calculate these residuals

To illustrate, suppose I have a time series with 10 elements. So, am I supposed to calculate a residual for each moment t? I understand that the residual is Observed Y - Predicted Y, but how do I calculate Predicted Y? I'm not sure if I'm explaining myself very well. Still, thank you for your time. Regards.

Hi Enrique,

thanks for reaching out! I understand that time series models can be confusing at first, especially when looking at the equations. In a nutshell, you wouldn't compute y_hat but instead, you'd use a model to compute the values for you. The y_hat values are called estimates and are what the model predicts will be the outcome at a certain point based on a given model and parameters. Later on in the practice section of the course, you'll see how that's achieved in Python. If you wish to gain some more understanding of how this works in general ml settings, you can check out the machine learning course we have and go through the linear algebra sections:

https://learn.365datascience.com/courses/machine-learning-in-python/course-introduction/

So, the formulas and equations we show during the theory part of the lesson is so that you can understand how the model works in general, i.e. how it incorporates the time element to make predictions. But in reality we don't really compute the values by hand, instead relying on ml, or in this case time series models instead.

Let me know if you have any other questions on the topic or the course.

Best,

365 Eli

Thank you for the response, however, I'm still in doubt 😅😅. Perhaps I didn't express myself well, and I'm aware that Python calculates remainders in a "hidden" way. It's this "secret calculation" that I wanted to know about. Searching for information on another website, I found the operation of an MA Model, which I would like you to tell me if it is correct.

1)An** ****initial value of the Theta parameters** is obtained from a system of equations formed by:

rk is the correlacion between Yt and Yt-k

2) **Estimate de Value of E0 (error t = 0)**

After that, we need to estimate E0 (error at t=0) for which there are 2 methods, conditional likelihood and unconditional likelihood. Once E0 is calculated,

3)** Calculate de rest of error **we can then calculate E1, E2, E3....

4) Once we have calculated the errors at different times, we can then **calculate the true value of theta **(*Theta truly*). For this, we use the equation

Yt = (*Theta truly*)Et-1 + Et.

A greeting, thank you in advance, and I'll be waiting ;)