Skip to contents

x may contain NA for a gap. method is one of the book's own options: ffill, bfill, linear, mean, or seasonal. Leading or trailing gaps a method cannot reach fall back to the series mean, so the output never contains a hole.

Usage

morie_tsimpute(x, method = "linear", season = 1L)

Arguments

x

the series, with NA for gaps

method

one of ffill, bfill, linear, mean, seasonal

season

the seasonal period, for method = "seasonal"

Value

list(x, nmissing, n, mean, method, imputedmean)

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_tsimpute(V)
#> $x
#> [1] 1 2 3 4 5 6 7 8
#> 
#> $nmissing
#> [1] 0
#> 
#> $n
#> [1] 8
#> 
#> $mean
#> [1] 4.5
#> 
#> $method
#> [1] "linear"
#> 
#> $imputedmean
#> [1] NaN
#>