bfast2 / bfast

Breaks For Additive Season and Trend
https://bfast2.github.io
GNU General Public License v2.0
41 stars 15 forks source link

Best approach to handling NA values #7

Closed GreatEmerald closed 4 years ago

GreatEmerald commented 6 years ago

NA values are a problem in time series analysis for seasonality and trend calculation. What is worse is that they tend to be temporally biased towards the rainy period, and we might have no observations whatsoever over the entire time series during particular times. This means that if we just omit the time steps with NAs, the trend estimation will also be biased towards values in the dry season.

There was also the matter of the stl package not handling data with NA values altogether.

One workaround (suggested by Achim) was to use bfastpp instead of stl to get simplified covariates, and then calculate the trend manually. Another is to use stlplus, but that imputes values. Discussion about the pros and cons and how to communicate that would be welcome.

GreatEmerald commented 6 years ago

Another thing to look at would be the timsac::decomp function as another alternative to stl. It also allows NA values, but I haven't tested how.

GreatEmerald commented 4 years ago

stlplus has been implemented, including s toggle switch to base stl.