diff --git a/previews/PR329/examples/index.html b/previews/PR329/examples/index.html
index 003fa66..6a20b0b 100644
--- a/previews/PR329/examples/index.html
+++ b/previews/PR329/examples/index.html
@@ -4,81 +4,81 @@
plt = plot(nile.year, nile.flow, label = "Nile river annual flow")
+
Next, we fit a LocalLevel
model:
model = LocalLevel(nile.flow)
fit!(model)
LocalLevel
We can analyze the filtered estimates for the level of the annual flow:
filter_output = kalman_filter(model)
plot!(plt, nile.year, get_filtered_state(filter_output), label = "Filtered level")
+We can do the same for the smoothed estimates for the level of the annual flow:
smoother_output = kalman_smoother(model)
plot!(plt, nile.year, get_smoothed_state(smoother_output), label = "Smoothed level")
+StateSpaceModels.jl can also be used to obtain forecasts. Here we forecast 10 steps ahead:
steps_ahead = 10
dates = collect(nile.year[end] + Year(1):Year(1):nile.year[end] + Year(10))
forec = forecast(model, 10)
@@ -359,81 +359,81 @@
plot!(plt, dates, expected_value, label = "Forecast")
+We can also simulate multiple scenarios for the forecasting horizon based on the estimated predictive distributions.
scenarios = simulate_scenarios(model, 10, 100)
plot!(plt, dates, scenarios[:, 1, :], label = "", color = "grey", width = 0.2)
+The package also handles missing values automatically. To that end, the package considers that any NaN
entries in the observations are missing values.
nile.flow[[collect(21:40); collect(61:80)]] .= NaN
plt = plot(nile.year, nile.flow, label = "Annual nile river flow")
+Even though the series has several missing values, the same analysis is possible:
model = LocalLevel(nile.flow)
fit!(model)
LocalLevel
And the exact same code can be used for filtering and smoothing:
filter_output = kalman_filter(model)
smoother_output = kalman_smoother(model)
@@ -1145,96 +1145,96 @@
plot!(plt, nile.year, get_smoothed_state(smoother_output), label = "Smoothed level")
+We often write the model SARIMA model as an ARIMA $(p,d,q) \times (P,D,Q,s)$, where the lowercase letters indicate the specification for the non-seasonal component, and the uppercase letters indicate the specification for the seasonal component; $s$ is the periodicity of the seasons (e.g. it is often 4 for quarterly data or 12 for monthly data). The data process can be written generically as
\[\begin{equation} \phi_p (L) \tilde \phi_P (L^s) \Delta^d \Delta_s^D y_t = A(t) + \theta_q (L) \tilde \theta_Q (L^s) \epsilon_t \end{equation}\]
where
sometimes we rewrite this as:
\[\begin{equation} @@ -1306,81 +1306,81 @@
The text from this example is based on Python`s statsmodels library. The estimates for this example match up to the 3th decimal place the results of the paper State Space Methods in Ox/SsfPack from the journal of statistical software.
In this example, we will follow what is illustrated on Commandeur, Jacques J.F. & Koopman, Siem Jan, 2007. "An Introduction to State Space Time Series Analysis," OUP Catalogue, Oxford University Press (Chapter 3). We will study the LocalLinearTrend
model with a series of the log of road traffic fatalities in Finalnd and analyse its slope to tell if the trend of fatalities was increasing or decrasing during different periods of time.
using StateSpaceModels, Plots, CSV, DataFrames
df = CSV.File(StateSpaceModels.VEHICLE_FATALITIES) |> DataFrame
log_ff = log.(df.ff)
plt = plot(df.date, log_ff, label = "Log of Finland road traffic fatalities")
+We fit a LocalLinearTrend
model = LocalLinearTrend(log_ff)
fit!(model)
LocalLinearTrend
By extracting the smoothed slope we conclude that according to our model the trend of fatalities in Finland was increasing in the years 1970, 1982, 1984 through to 1988, and in 1998
smoother_output = kalman_smoother(model)
plot(df.date, get_smoothed_state(smoother_output)[:, 2], label = "slope")
+This example illustrates how to perform vehicle tracking from noisy data.
using Random
Random.seed!(1)
@@ -1675,169 +1675,169 @@
-Settings
This document was generated with Documenter.jl version 0.27.25 on Thursday 3 October 2024. Using Julia version 1.0.5.