Questions tagged [moving-average]

A calculation of the average value of the most recent (within some window) values in a time series, rather than the average of the entire series.

Moving average is a calculation of the average value of the most recent (within some window) values in a time series, rather than the average of the entire series.

1034 questions
-1
votes
1 answer

C++ program for calculating moving average

UPDATED: I am writing a program that finds the moving average and I cannot seem to figure out why my code does not work. It gets the correct numbers but does not format correctly. For example, my program outputs "34" instead of "34.00" and I thought…
-1
votes
1 answer

Calculate and store average for following table in SQL Server

I am trying to calculate average of P value in following table as per month in per_date column grouped by qu_def column. and store it as follows in a SQL Server table:
V_immo
  • 31
  • 1
  • 7
-1
votes
1 answer

Averages in SAS with date buckets

I've been working with SAS to get some rolling averages, and I can get it to give me those outputs but I want it done by date buckets if possible, which I don't quite know how to do. Here's some sample data: Date Amount User Moving…
blargh
  • 29
  • 1
  • 8
-1
votes
1 answer

How can I obtain hourly readings from 24 hour moving average data?

I have an excel dataset of 24-hour moving averages for PM10 air pollution concentration levels, and need to obtain the individual hourly readings from them. The moving average data is updated every hour, so at hour t, the reading is the average of…
Andrew
  • 1
  • 1
-1
votes
1 answer

How to compute a moving average of value for the previous date untill the first event?

I have a dataframe with data where the first column is an identification number, ID1, the second is a date, DATE, and the third is some value, VALUE. d = {'ID1': [1,2,3,4,1,2,4,1,3,2,4,1], 'DATE': ['1/06/2016',…
Pere Munar
  • 49
  • 7
-1
votes
1 answer

SQL self-join to get values of 3 weeks ago

I am not very familiar with sql however I have to do a query for a sale prediction. The data is for the sale with distinct prodID, shopID, weekDay, date and Sale. I need to get the sale of the same product in the same shop and same weekDay in the…
physiker
  • 889
  • 3
  • 16
  • 30
-1
votes
1 answer

How to debug where a map-reduce fails?

I compile the program it runs successfully but mapper reducer fails; I need help in code to run the mapper and reducer successfully. I guess there are some parsing issues in the code. Attached are the errors and below that is the code. How can I…
anmol
  • 13
  • 2
-1
votes
1 answer

Calculation of a moving average using mysql leads to problems if there are gaps in the datasets

My problem is that I try to calculate a moving average over some values from my table (one avg value for each row). It actually works but if it comes to gaps such as id[20,18,17] or date[2018-05-11,2018-05-9,2018-05-8] the calculation becomes wrong.…
rodarmy
  • 1
  • 2
-1
votes
3 answers

r replace each missing value with a mean of two previous values

I have a data frame with some NAs in column 'myvalues': x <- data.frame(mydates = as.Date(c("2018/04/01","2018/04/02","2018/04/03","2018/04/04", …
user3245256
  • 1,842
  • 4
  • 24
  • 51
-1
votes
1 answer

pass struct of arrays into function

I am trying to pass a struct of 2D arrays and to do calculations on them. typedef struct{ float X[80][2]; float Y[80][2]; float Z[80][2]; int T[80][2]; int K[80]; } STATS; void MovingAverage(STATS *stat_array, int last_stat) { …
David
  • 111
  • 1
  • 2
  • 8
-1
votes
2 answers

Taking the average of a sliced list

The problem I'm having is attempting to take the average of my list (derived from y, which is a list of sin values). However, when running the code, I get the error TypeError: float() argument must be a string or a number, not 'list' Any help you…
D. Powell
  • 3
  • 1
-1
votes
4 answers

What's the “epsilon” of an Exponential Moving Average?

I'm applying an Exponential Moving Average as filter for smooth params within my audio application: a0 = 0.01 z += a0 * (input - z); Here's the code and the firsts 50 steps: #include int main () { double a0 = 0.1; double input =…
markzzz
  • 47,390
  • 120
  • 299
  • 507
-1
votes
1 answer

Moving Window Sum product Calculation Python

I have the following lists: a= [1,2,3,4,5,6,7,8,9,10,11,12] wts= [0.055555556,0.055555556,0.055555556,0.055555556,0.055555556,0.055555556,0.055555556,0.055555556,0.055555556,0.10,0.10,0.30] The Desired result is result =…
ceeka9388
  • 69
  • 8
-1
votes
2 answers

Incrementally updatating rows using values from previous rows in R

I need to run a script in R that updates values in given rows regarding the history of previous rows. More specifically, I want to calculate averages on some given columns over time. I'll explain. Say, I have the following table: Key A B C …
htaunay
  • 73
  • 1
  • 2
  • 9
-1
votes
2 answers

Average values; FOR loops

If I have a 5x5 matrix called MATRIX1 like this: 12 13 14 15 16 21 23 24 25 26 31 43 52 23 43 63 36 74 47 45 21 23 32 34 43 How can I make a for loop (or something similar) which will give me a new matrix with average values of…