Moving Average in User Chart

122 views
Skip to first unread message

David Farquhar

unread,
Jun 22, 2022, 10:49:10 AM6/22/22
to golden-cheetah-users
Hi,

I'm using the User Chart in 3.6 to plot a metric and then a moving average of this metric.

The Moving Average function accepts a parameter for a choice of Backward, Forward, Centered.

I am calculating a moving average over 7 days, and when I choose Backward I expect it to average today's value, plus the previous 6 days' values.  If I choose Forwards I expect it to average today's value plus the next 6 day's values.

However it seems to be working the other way round.  Forwards looks at today plus previous 6 days, and Backwards is today plus the 6 days into the future.  Have I got my expectations the wrong way round?  Now that I've figured out the way it works I can use Forwards all the time, but I wanted to check. Example of the formula I'm using is below (this is running against a user metric I added)

smooth(measures("Body", "Body_Battery"),sma, forward,7)  

David

Ale Martinez

unread,
Jun 22, 2022, 11:06:35 AM6/22/22
to golden-cheetah-users

David Farquhar

unread,
Apr 15, 2023, 3:31:39 PM4/15/23
to golden-cheetah-users
One other question about moving average - it looks like the function only has access to the range of data displayed on the chart.  So if I'm doing a backward moving average with a window of 7 days, in the first 6 days the calculations only pick up the relevant data showing on the chart.  So the very first point is the moving average of that day's data only, not that day plus the previous 6.

Is there any way to change this so the moving averages have access to the data earlier than the start of the chart?

Ale Martinez

unread,
Apr 15, 2023, 5:18:35 PM4/15/23
to golden-cheetah-users
El sábado, 15 de abril de 2023 a la(s) 16:31:39 UTC-3, David Farquhar escribió:
One other question about moving average - it looks like the function only has access to the range of data displayed on the chart.  So if I'm doing a backward moving average with a window of 7 days, in the first 6 days the calculations only pick up the relevant data showing on the chart.  So the very first point is the moving average of that day's data only, not that day plus the previous 6.

Is there any way to change this so the moving averages have access to the data earlier than the start of the chart?

Moving average uses the vector you pass as parameter, if you want to access data outside of the current date range in Trends view look for the daterange closure function in the docs. 
Reply all
Reply to author
Forward
0 new messages