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
0
votes
2 answers

Calculating moving average of a stream of values stored in a vector

I have a vector of structures that stores a stream of values that arrive at different intervals. The structure consists of two elements , one for the value and the other records the time when the value arrived. struct Data { Time…
anikomei
  • 73
  • 1
  • 9
0
votes
1 answer

Resample a Pandas dataframe with coefficients

I have a data frame with the following columns: {'day','measurement'} And there might be several measurements in a day (or no measurements at all) For example: day | measurement 1 | 20.1 1 | 20.9 3 | 19.2 4 …
Uri Goren
  • 13,386
  • 6
  • 58
  • 110
0
votes
1 answer

accumulateWeighted function assertion fails in OpenCV

Using OpenCv with C++, I am trying to perform running average on frames of a video to extract the foreground. But I cannot find out what's wrong with the accumulateWeighted function. The program stops running when it comes to that function, giving…
0
votes
4 answers

In R, average row value until hit a specific condition, then restart, with output in new column

I am working with GPS data and trying to figure out how to average the 11th-15th fixes for latitude and longitude. I have seen solutions in similar questions for how to average every n rows. The problem is that occasionally the satellites bomb out…
MPhD
  • 456
  • 2
  • 9
0
votes
0 answers

Zoo max of varying interval length

I have been trying (unsuccessfully) to create a dynamic function in R that stores the max value of a vector with a repeating interval. Here is an example of what I'm trying to accomplish. library(zoo) x <- rep(1:3, times = 10) width <- rep(1:3,…
0
votes
0 answers

R: Moving window

I have a dataset like this: > head(test,20) Temp Precip species 3 9.4007956 59.27015 oak 4 -0.4519635 47.40692 scots_pine 5 11.6495457 64.51529 beech 6 5.2807114 101.44833 picea_abies 9 5.3833591 53.95441 …
fede_luppi
  • 1,063
  • 4
  • 17
  • 29
0
votes
2 answers

moving average by date in mysql

I want to retrieve a moving average of a cosumes table. I have written the following query but it doesn't work. It retrieves higher averages for the first days. What am I doing wrong? select c.fecha, count(r.cantidad), avg(r.cantidad) from (select…
criptero
  • 41
  • 3
0
votes
2 answers

rollmean length of timeseries

I have a time series of regular 15 minute data intervals and I want to take a rolling average of the data for every 2 hours, hence the width of the rollmean interval would be 8. The only issue is that the length of the original time series that I…
Saadat
  • 51
  • 8
0
votes
1 answer

Rolling past and future averages from current value

I think I am mostly there, but I can't figure out the remaining piece of how to code this properly. I begin with a single column of 15 values. I want to create two new columns with the 'previous' containing the average of the previous two values,…
runningbirds
  • 6,235
  • 13
  • 55
  • 94
0
votes
0 answers

running python with two statsmodels versions possible?

I just downloaded Statsmodels 0.6.1 with easy_install -U statsmodels i.e. I choose to upgrade my existing statsmodels. I work with OS X/anaconda/spyder. When running my imports, python still imports the old version of statsmodels. import numpy as…
0
votes
1 answer

awk - moving average in blocks of ascii-file

I have a big ascii-file that looks like…
MacA
  • 25
  • 5
0
votes
0 answers

Data Analysis and Forecasting In MATLAB

I have a house price data with two rows, 1st: Date (monthly) and 2nd: Price of house, my data has the price record of houses from 1990-2012, I would like to predict the price of house in 2013 by calculating the moving average of the prices i have to…
Young_DataAnalyst
  • 263
  • 2
  • 4
  • 11
0
votes
1 answer

Is there an efficient way to calculate rolling deviation from mean?

I'd like to calculate the mean deviation '1/n[sum(Xi-mu)]' with rolling window. The 'mu' is rolling average. And Xi is rolling observation, too. Here is my sample code with window size…
YYY
  • 605
  • 3
  • 8
  • 16
0
votes
1 answer

Creating series with estimated coefficients

I managed to estimate some ARIMA models, got coefficients, but just wondering is there an easy way how to plot series using the estimated coeffcients? So I gota arimadax1<-auto.arima(dax1,d=2, max.order=50,max.d=2, start.q=0,max.p=5, max.q=10, …
Jan Sila
  • 1,554
  • 3
  • 17
  • 36
0
votes
0 answers

Calculating moving average with different codes and different sizes

I have a data frame that contains data for different observations, where the observations are grouped with a unique code. As a reproducible example, here is how a simulated data looks like: v <-…
H_A
  • 667
  • 2
  • 6
  • 13