I want to implement a rolling WLS regression such that more recent data points are weighted more heavily than older ones. Pandas has the very convenient EWM object for exponentially-weighted aggregations, but to my knowledge the API only supports accessing the final aggregations. I would like to extract the actual weights matrix that multiplies the original dataframe to create the EWM dataframe, which I can then use to pass weights to some WLS software. If this is impossible, if someone could help me to manually write the function for generating such a matrix it would be much appreciated (I would almost exclusively be using the span parameter to generate weights, if that helps).
-
I believe in the doc, you can find the function used. And the alpha from span is described in this doc. Is it what you look for?Ben.T– Ben.T2024-02-19 21:02:56 +00:00Commented Feb 19, 2024 at 21:02
-
@Ben.T The doc describes the theory behind the EWM weighting, but I don't want to re-implement the math from scratch if this is avoidableYudoSmootho– YudoSmootho2024-02-19 22:16:39 +00:00Commented Feb 19, 2024 at 22:16
Add a comment
|