Time series autocorrelation with missing years
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a time series that is missing some years. I want to calculate the autocorrelation function. But autocorr does not allow us to specify a vector for the time points corresponding to the vector we are calculating autocorrelation for.
In other words, if I use autocorr(herbicide_amount), because I only have data for the years 1996, 1997, 1998, 1999, 2000, 2001, 2005, and 2010, the autocorrelation calculated and plotted will consider the herbicide_amount in 2005 to be one lag away from 2001, when it should actually be four lags away, and so on.
Is there a way to make this work? Or am I stuck with using just the data that's available in consecutive years (1996 to 2001)?
I realize that this may be more of a mathematical question than a coding one.
0 comentarios
Respuestas (1)
azim
el 8 de Jun. de 2020
hi,
did you consider using retime and filling in the time gap in your timetable data. for eg. as per the documentation example:
Time = datetime({'2015-12-18 07:02:12';'2015-12-18 08:00:47';...
'2015-12-18 09:01:37';'2015-12-18 10:03:10';...
'2015-12-18 10:59:34'});
Temp = [37.3;41.9;45.7;42.3;39.8];
Pressure = [30.1;29.9;30.03;29.9;29.8];
TT = timetable(Time,Temp,Pressure)
TT2 = retime(TT,'hourly','spline')
you can read about it on the link mathworks.com/help/matlab/ref/timetable.retime.html
there are many methods for filling in the gaps like spline, mean, linear etc. so you can choose the method which suits your data the best. hope this helps
0 comentarios
Ver también
Categorías
Más información sobre Data Preprocessing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!