Skip to contents

[Stable]

This function is used to predict future growth rates based on a model object created using the 'aedseo' package. It takes the model object and the number of future time steps (n_step) for which you want to make predictions and returns a prediction tibble.

Usage

# S3 method for aedseo
predict(object, n_step = 3, ...)

Arguments

object

A model object created using the aedseo package, typically the result of the aedseo() function.

n_step

An integer specifying the number of future time steps for which you want to predict growth rates. Default is 3.

...

Additional arguments (not used).

Value

A tibble S3 object called aedseo containing the predicted growth rates, including time, estimated growth rate, lower confidence interval, and upper confidence interval for the specified number of future time steps.

Examples

# Analyze the data using the aedseo package
tsd_data <- tsd(
  observed = c(100, 120, 150, 180, 220, 270),
  time = as.Date(c(
    "2023-01-01",
    "2023-01-02",
    "2023-01-03",
    "2023-01-04",
    "2023-01-05",
    "2023-01-06"
  )),
  time_interval = "day"
)

aedseo_results <- aedseo(
  tsd = tsd_data,
  k = 3,
  level = 0.95,
  family = "poisson"
)

# Predict growth rates for the next 5 time steps
prediction <- predict(object = aedseo_results, n_step = 5)

# Print the prediction
print(prediction)
#> # A tibble: 6 × 5
#>       t time       estimate lower upper
#>   <int> <date>        <dbl> <dbl> <dbl>
#> 1     0 2023-01-06     270   270   270 
#> 2     1 2023-01-07     331.  301.  363.
#> 3     2 2023-01-08     405.  336.  489.
#> 4     3 2023-01-09     496.  375.  658.
#> 5     4 2023-01-10     608.  418.  885.
#> 6     5 2023-01-11     745.  467. 1191.