Learn R Programming

ankiR (version 0.6.0)

anki_forecast_monte_carlo: Monte Carlo Forecasting

Description

Forecast future reviews using Monte Carlo simulation with bootstrapping. Unlike statistical methods (ARIMA, Holt-Winters), this approach:

  • Makes no distributional assumptions

  • Preserves day-of-week patterns naturally

  • Handles irregular study habits (missed days, catch-up sessions)

  • Provides empirical confidence intervals

Usage

anki_forecast_monte_carlo(
  path = NULL,
  profile = NULL,
  days_ahead = 30,
  n_sim = 1000,
  method = "weekday",
  block_size = 7,
  include_trend = TRUE,
  seed = NULL
)

Value

A list with forecast distribution, summary statistics, and simulation data

Arguments

path

Path to collection.anki2 (auto-detected if NULL)

profile

Profile name (first profile if NULL)

days_ahead

Number of days to forecast (default 30)

n_sim

Number of simulations (default 1000)

method

Bootstrap method: "weekday" (preserves day-of-week), "block" (preserves sequences), "simple" (iid sampling)

block_size

Block size for block bootstrap (default 7)

include_trend

Whether to include trend component (default TRUE)

seed

Random seed for reproducibility (NULL for random)

Examples

Run this code
if (FALSE) {
mc <- anki_forecast_monte_carlo(days_ahead = 30, n_sim = 1000)

# Summary
mc$summary

# Probability of >100 reviews on day 7
mc$prob_above(day = 7, threshold = 100)

# Full simulation matrix
dim(mc$simulations)  # n_sim x days_ahead
}

Run the code above in your browser using DataLab