Hello everyone, I need to calculate stock beta using the formula: beta= covariance (Rm,Ri) / variance (Rm). I need to calculate beta using 24-60 observations. So, I need to create a new column that has the betas for each date-company calculated depending on the last 24-60 observations (no problem if it started from the current observation). I can create lags but I want more practical solution please giving that my data have several companies. here is how my data looks: date company Ri Rm Jan-2001 A 3% 3.5% Feb-2001 A 3.2% 3.9% Mar-2001 A 2.7% 3.1% . . . Jan-2001 B 3.9% 3.5% Feb-2001 B 4.1% 3.9% Mar-2001 B 3.3% 3.1% . . your help is appreciated. thank you in advance
... View more