Skip to contents

Formula: robust locally weighted regression of daily counts on time. At each day x0 the fit is the intercept of the weighted least-squares line of cases on dates - x0 with tricube neighbourhood weights w_i = (1 - |x_i - x0|^3 / h^3)^3 for |x_i - x0| < h (Cleveland 1979 eq. 2), followed by iterations robustness passes weighting each observation by the bisquare of its residual scaled by six times the median absolute residual, delta_i = (1 - (r_i / (6 s))^2)^2 for |r_i| < 6 s (eq. 5-7). A fixed bandwidth in day units replaces Cleveland's nearest-neighbour span.

Usage

Epicur(dates, cases, bandwidth, iterations = 2)

Arguments

dates

Day index of each observation.

cases

Counts observed on those days.

bandwidth

Neighbourhood half-width h in date units (> 0).

iterations

Robustness passes (0 gives plain local linear).

Value

List with estimate, fitted, peak_date, peak_value, total, n, method.

References

Cleveland (1979), JASA 74(368):829-836, doi:10.1080/01621459.1979.10481038.

Examples

Epicur(dates = c(1, 2, 3, 4, 5, 6, 7, 8), cases = c(1, 2, 3, 4, 5, 6, 7, 8), bandwidth = 0.5)
#> $estimate
#> [1] 8
#> 
#> $fitted
#> [1] 1 2 3 4 5 6 7 8
#> 
#> $peak_date
#> [1] 8
#> 
#> $peak_value
#> [1] 8
#> 
#> $total
#> [1] 36
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "Epidemic curve smoothing"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"