Dear STATA community,

I almost feel a bit ashamed to ask this, but I am very new to STATA and many things are still a blackbox for me. I found this forum and its post so far veeeeeeery helpful!

So, for a research paper on ETFs and their tracking ability I have to use STATA to get the error term values of the market model. What I have to calculate is the following:
Array
So the focus is on the 'epsilon' (error term). Maybe here good to mention is that I have 16 ETFs with daily (return) data for somewhat between 8 and 13 years (depending on the ETF). Their identifier is "TickerSymbol1".

I got so far that I ran regressions for each ETF using commands like:

xtset TickerSymbol1 date
panel variable: TickerSymbol1 (unbalanced)
time variable: date, 03jan2007 to 31dec2019, but with gaps
delta: 1 day

xtreg Dailyreturnetfin Dailyreturnindexin if TickerSymbol1 == 1, fe

Array

so I know that basically the sigma_e here seems to be the tracking error. However, this is basically over the entire period.

Now in order to run regressions later on to find potential determinants of it (where the TE becomes the Y), I will need to have at least monthly values. And here I am super stuck now. Because basically I would then need "sigma_e" for each observation so that I could calculate the Tracking Error according to the formula above but then for each month.

I also had been trying this:

predict stdp1 if TickerSymbol1 == 1, stdp

Because I thought that this would provide me with the standard errors for each observation/day. But after all the posts and videos I have tried to read and watch I am confused now what the right approach is in my matter.

Sorry about the long post, but it may be more clear then.

Any help is greatly appreciated since it will anyways help me making a step further

Thanks and best,
Marina