Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

roll_mad() - Mean | Median Absolute Deviation #22

Open
Eluvias opened this issue Sep 12, 2019 · 3 comments
Open

roll_mad() - Mean | Median Absolute Deviation #22

Eluvias opened this issue Sep 12, 2019 · 3 comments

Comments

@Eluvias
Copy link

Eluvias commented Sep 12, 2019

Would that fit to the existing framework / family functions?

@jasonjfoster
Copy link
Owner

The current list of functions is mostly from my own survey of rolling statistics that focuses on common use cases and demand, so could you share links to other GH repos or SO questions that discuss something like roll_mad? For more background, the function implementations in roll need to offer an "online" algorithm, which is more difficult, so need to consider the cost-benefit of each function too. Luckily the roll package does some of the heavy-lifting via roll_median that can be used in another function to calculate roll_mad (also as a one-off exercise too), if needed.

@Eluvias
Copy link
Author

Eluvias commented Sep 18, 2019

An R package with a rolling mad implementation is TTR with runMAD() function which has the option stats to return either the rolling median or mean absolute deviation.

Another R implementation is caTools::runmad().

MATLAB has a family of core Moving Statistics which includes a rolling median absolute deviation
via movmad function.

MATHEMATICA has MedianDeviation but offers a generic MovingMap to apply any function, so there is no need for a separate implementation.

Perhaps only for the case of the median absolute deviation, it looks natural for the roll package to offer an additional but more robust measure of dispersion.

Thank you.

@dimfalk
Copy link

dimfalk commented Nov 9, 2023

I'd also be very much interested in having this function!

{RcppRoll} also has this feature request (kevinushey/RcppRoll#38) but does not seem to be maintained very actively - this is how I found {roll} in the end - but maybe this snippet in {m181} could be of some help:

https://github.com/dleutnant/m181/blob/9b8160b9596225dbcc5671c6cf0d64e90711b710/src/m181_criteria_core.cpp#L119-L133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants