Applying a rolling window regression to an XTS series in R
问题 I have an xts of 1033 daily returns points for 5 currency pairs on which I want to run a rolling window regression, but rollapply is not working for my defined function which uses lm(). Here is my data: > head(fxr) USDZAR USDEUR USDGBP USDCHF USDCAD 2007-10-18 -0.005028709 -0.0064079963 -0.003878743 -0.0099537170 -0.0006153215 2007-10-19 -0.001544470 0.0014275520 -0.001842564 0.0023058211 -0.0111410271 2007-10-22 0.010878027 0.0086642116 0.010599365 0.0051899551 0.0173792230 2007-10-23 -0