Description Usage Arguments Details Value Author(s) References Examples
View source: R/utils-interpolation.R
Interpolate monthly time series to daily using a mean-preserving autoregressive method.
1 |
y_points |
Numeric vector with mean values at each timestep. |
month_len |
Numeric vector with the number of days that each timestep
represents. These can be obtained with |
max_val |
Numeric value with the upper bound for the interpolated entries. |
min_val |
Numeric value with the lower bound for the interpolated entries. |
This method assumes a cycle (i.e. the last date interpolated influences the first date as well).
The idea of how this was done was taken from:
Rymes, M.D. and Myers, D.R., 2001. Mean preserving algorithm for smoothly interpolating averaged data. Solar Energy, 71(4), pp.225-231. DOI/URL: https://doi.org/10.1016/S0038-092X(01)00052-4
The method outlined in the paper does not work entirely, and some equations have been tweaked. (MN(i) = MN(i) + C(K) as to MN(i) - C(K) and Equation 8 of the paper.
Numeric vector with the interpolated values, this one has the same length as the total sum of month_len.
Kamolphat Atsawawaranunt
Rymes, M.D. and Myers, D.R., 2001. Mean preserving algorithm for smoothly interpolating averaged data. Solar Energy, 71(4), pp.225-231. DOI/URL: https://doi.org/10.1016/S0038-092X(01)00052-4
1 2 3 4 5 6 7 8 9 10 11 12 13 | # month length the data represents
month_len = c(31, 29 ,31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
y_points <- c(0, 0.1, 0.25, 0.5, 0.9, 1.0, 0.93, 0.8, 0.5, 0.25, 0.1, 0)
max_val <- 1
min_val <- 0
# interpolate with no bounds
y_interpolated <- int_acm(y_points, month_len)
# interpolate with maximum bounds
y_interpolated <- int_acm(y_points, month_len, max_val = max_val)
# interpolate with minimum bounds
y_interpolated <- int_acm(y_points, month_len, min_val = min_val)
# interpolate with bounds
y_interpolated <- int_acm(y_points, month_len, max_val, min_val)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.