Skip to content

Commit 28423a9

Browse files
Update minor version (#334)
* Update minor version * fix tests * bump actions * update jldoctest * Update .github/workflows/documentation.yml Co-authored-by: Raphael Saavedra <raphael.saavedra93@gmail.com> * fix more docs * fix another output from doctest * fix docs * fix exports * update * fix cross referencing --------- Co-authored-by: Raphael Saavedra <raphael.saavedra93@gmail.com>
1 parent b15f942 commit 28423a9

17 files changed

+61
-60
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ jobs:
2222
os: ubuntu-latest
2323
arch: x86
2424
steps:
25-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v4
2626
- uses: julia-actions/setup-julia@v1
2727
with:
2828
version: ${{ matrix.version }}
2929
arch: ${{ matrix.arch }}
30-
- uses: actions/cache@v1
30+
- uses: actions/cache@v4
3131
env:
3232
cache-name: cache-artifacts
3333
with:
@@ -40,6 +40,6 @@ jobs:
4040
- uses: julia-actions/julia-buildpkg@v1
4141
- uses: julia-actions/julia-runtest@v1
4242
- uses: julia-actions/julia-processcoverage@v1
43-
- uses: codecov/codecov-action@v1
43+
- uses: codecov/codecov-action@v5
4444
with:
4545
file: lcov.info

.github/workflows/doc_cleanup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout gh-pages branch
12-
uses: actions/checkout@v2
12+
uses: actions/checkout@v4
1313
with:
1414
ref: gh-pages
1515
- name: Delete preview and history + push changes

.github/workflows/documentation.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
1313
- uses: julia-actions/setup-julia@latest
1414
with:
15-
# Build documentation on Julia 1.0
16-
version: '1.0'
15+
version: '1'
1716
- name: Install dependencies
1817
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
1918
- name: Build and deploy

Project.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "StateSpaceModels"
22
uuid = "99342f36-827c-5390-97c9-d7f9ee765c78"
33
authors = ["raphaelsaavedra <raphael.saavedra93@gmail.com>, guilhermebodin <guilherme.b.moraes@gmail.com>, mariohsouto"]
4-
version = "0.6.9"
4+
version = "0.7.0"
55

66
[deps]
77
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
@@ -19,16 +19,16 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1919
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
2020

2121
[compat]
22-
Distributions = "0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25"
23-
MatrixEquations = "1, 2"
24-
Optim = "0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 1.2"
22+
Distributions = "0.25"
23+
MatrixEquations = "2"
24+
Optim = "1"
2525
OrderedCollections = "1"
26-
Polynomials = "1, 2"
26+
Polynomials = "4"
2727
RecipesBase = "1"
2828
SeasonalTrendLoess = "0.1"
29-
ShiftedArrays = "1"
30-
StatsBase = "0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34"
31-
julia = "1"
29+
ShiftedArrays = "2"
30+
StatsBase = "0.34"
31+
julia = "1.6"
3232

3333
[extras]
3434
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"

docs/src/examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ plot(df.date, get_smoothed_state(smoother_output)[:, 2], label = "slope")
197197

198198
This example illustrates how to perform vehicle tracking from noisy data.
199199

200-
```@setup bt
200+
```@setup vehicle_tracking
201201
using StateSpaceModels, Random
202202
using Plots
203203
```

docs/src/manual.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ LinearMultivariateTimeVariant
100100

101101
The model hyperparameters are constant (non-time-varying) parameters that are optimized when [`fit!`](@ref) is called. The package provides some useful functions to accelerate experimentation and custom model development.
102102

103+
```@docs
104+
StateSpaceModels.HyperParameters
105+
```
106+
103107
The getters are:
104108
```@docs
105109
get_names
@@ -124,14 +128,17 @@ unconstrain_identity!
124128

125129
## Filters and smoothers
126130

127-
StateSpaceModels.jl lets users define tailor-made filters in an easy manner. TODO docs here
131+
StateSpaceModels.jl lets users define tailor-made filters in an easy manner.
128132

129133
```@docs
130134
UnivariateKalmanFilter
131135
ScalarKalmanFilter
132136
SparseUnivariateKalmanFilter
137+
MultivariateKalmanFilter
133138
FilterOutput
134139
SmootherOutput
140+
kalman_filter
141+
kalman_smoother
135142
get_innovations
136143
get_innovations_variance
137144
get_filtered_state
@@ -149,7 +156,7 @@ StateSpaceModels.jl has an interface for [Optim.jl](https://github.com/JuliaNLSo
149156
```@docs
150157
fit!
151158
Optimizer
152-
results
159+
print_results
153160
has_fit_methods
154161
isfitted
155162
```
@@ -198,8 +205,8 @@ plot(model, ks)
198205
```@example
199206
using StateSpaceModels, CSV, DataFrames, Plots
200207
201-
finland_fatalities = CSV.File(StateSpaceModels.NILE) |> DataFrame
202-
model = UnobservedComponents(nile; trend = "local level", cycle = "stochastic")
208+
nile = CSV.File(StateSpaceModels.NILE) |> DataFrame
209+
model = UnobservedComponents(nile.flow; trend = "local level", cycle = "stochastic")
203210
fit!(model)
204211
kf = kalman_filter(model)
205212
@@ -219,4 +226,5 @@ StateSpaceModels.RJ_TEMPERATURE
219226
StateSpaceModels.VEHICLE_FATALITIES
220227
StateSpaceModels.WHOLESALE_PRICE_INDEX
221228
StateSpaceModels.US_CHANGE
229+
StateSpaceModels.SUNSPOTS_YEAR
222230
```

src/StateSpaceModels.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export LocalLevelCycle
7878
export LocalLevelExplanatory
7979
export LocalLinearTrend
8080
export MultivariateBasicStructural
81+
export MultivariateKalmanFilter
8182
export Naive
8283
export Optimizer
8384
export SARIMA

src/cross_validation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ end
4141
4242
Makes rolling window estimating and forecasting to benchmark the forecasting skill of the model
4343
in for different time periods and different lead times. The function returns a struct with the MAE
44-
and mean CRPS per lead time. See more on [CrossValidation the forecasts of a model](@ref)
44+
and mean CRPS per lead time. See more on [Cross validation of the forecasts of a model](@ref)
4545
4646
# References
4747
* DTU course "31761 - Renewables in electricity markets" available on youtube https://www.youtube.com/watch?v=Ffo8XilZAZw&t=556s

src/filters/multivariate_kalman_filter.jl

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
"""
2-
MultivariateKalmanState{Fl <: AbstractFloat}
3-
4-
A Kalman filter that is tailored to multivariate systems.
5-
"""
61
mutable struct MultivariateKalmanState{Fl<:AbstractFloat}
72
v::Vector{Fl}
83
F::Matrix{Fl}
@@ -320,7 +315,7 @@ function filter_recursions!(
320315
)
321316
end
322317
catch
323-
@error("Numerical error when applying Kalman filter euqations, the current state is: $kalman_state")
318+
@error("Numerical error when applying Kalman filter equations")
324319
rethrow()
325320
end
326321
return kalman_state.llk
@@ -350,7 +345,7 @@ function filter_recursions!(
350345
)
351346
end
352347
catch
353-
@error("Numerical error when applying Kalman filter euqations, the current state is: $kalman_state")
348+
@error("Numerical error when applying Kalman filter equations")
354349
rethrow()
355350
end
356351
return kalman_state.llk
@@ -383,7 +378,7 @@ function filter_recursions!(
383378
save_kalman_state_in_filter_output!(filter_output, kalman_state, t)
384379
end
385380
catch
386-
@error("Numerical error when applying Kalman filter euqations, the current state is: $kalman_state")
381+
@error("Numerical error when applying Kalman filter equations")
387382
rethrow()
388383
end
389384
return filter_output
@@ -415,7 +410,7 @@ function filter_recursions!(
415410
save_kalman_state_in_filter_output!(filter_output, kalman_state, t)
416411
end
417412
catch
418-
@error("Numerical error when applying Kalman filter euqations, the current state is: $kalman_state")
413+
@error("Numerical error when applying Kalman filter equations")
419414
rethrow()
420415
end
421416
return filter_output

src/filters/regression_kalman_filter.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
"""
2-
RegressionKalmanState{Fl <: AbstractFloat}
1+
# RegressionKalmanState{Fl <: AbstractFloat}
32

4-
Similar to the univariate Kalman filter, but exploits the structure of the regression system
5-
matrices - in particular, the fact that the variance of the state (`P`) is always zero, as
6-
well as `R` and `Q`.
7-
"""
3+
# Similar to the univariate Kalman filter, but exploits the structure of the regression system
4+
# matrices - in particular, the fact that the variance of the state (`P`) is always zero, as
5+
# well as `R` and `Q`.
86
mutable struct RegressionKalmanState{Fl<:AbstractFloat}
97
v::Fl
108
F::Fl

src/filters/scalar_kalman_filter.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ function filter_recursions!(
209209
)
210210
end
211211
catch
212-
@error("Numerical error when applying Kalman filter euqations, the current state is: $kalman_state")
212+
@error("Numerical error when applying Kalman filter equations")
213213
rethrow()
214214
end
215215
return kalman_state.llk
@@ -242,7 +242,7 @@ function filter_recursions!(
242242
save_kalman_state_in_filter_output!(filter_output, kalman_state, t)
243243
end
244244
catch
245-
@error("Numerical error when applying Kalman filter euqations, the current state is: $kalman_state")
245+
@error("Numerical error when applying Kalman filter equations")
246246
rethrow()
247247
end
248248
return filter_output

src/filters/sparse_univariate_kalman_filter.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ function filter_recursions!(
275275
)
276276
end
277277
catch
278-
@error("Numerical error when applying Kalman filter euqations, the current state is: $kalman_state")
278+
@error("Numerical error when applying Kalman filter equations")
279279
rethrow()
280280
end
281281
return kalman_state.llk
@@ -310,7 +310,7 @@ function filter_recursions!(
310310
save_kalman_state_in_filter_output!(filter_output, kalman_state, t)
311311
end
312312
catch
313-
@error("Numerical error when applying Kalman filter euqations, the current state is: $kalman_state")
313+
@error("Numerical error when applying Kalman filter equations")
314314
rethrow()
315315
end
316316
return filter_output

src/filters/univariate_kalman_filter.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ function filter_recursions!(
327327
)
328328
end
329329
catch
330-
@error("Numerical error when applying Kalman filter euqations, the current state is: $kalman_state")
330+
@error("Numerical error when applying Kalman filter equations.")
331331
rethrow()
332332
end
333333
return kalman_state.llk
@@ -357,7 +357,7 @@ function filter_recursions!(
357357
)
358358
end
359359
catch
360-
@error("Numerical error when applying Kalman filter euqations, the current state is: $kalman_state")
360+
@error("Numerical error when applying Kalman filter equations")
361361
rethrow()
362362
end
363363
return kalman_state.llk
@@ -390,7 +390,7 @@ function filter_recursions!(
390390
save_kalman_state_in_filter_output!(filter_output, kalman_state, t)
391391
end
392392
catch
393-
@error("Numerical error when applying Kalman filter euqations, the current state is: $kalman_state")
393+
@error("Numerical error when applying Kalman filter equations")
394394
rethrow()
395395
end
396396
return filter_output
@@ -423,7 +423,7 @@ function filter_recursions!(
423423
save_kalman_state_in_filter_output!(filter_output, kalman_state, t)
424424
end
425425
catch
426-
@error("Numerical error when applying Kalman filter euqations, the current state is: $kalman_state")
426+
@error("Numerical error when applying Kalman filter equations")
427427
rethrow()
428428
end
429429
return filter_output

src/fit.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ the [Optim.jl](https://github.com/JuliaNLSolvers/Optim.jl) optimization algortih
1414
# Example
1515
```jldoctest
1616
julia> model = LocalLevel(rand(100))
17-
LocalLevel model
17+
LocalLevel
1818
1919
julia> fit!(model)
20-
LocalLevel model
20+
LocalLevel
2121
2222
julia> model = LocalLinearTrend(LinRange(1, 100, 100) + rand(100))
23-
LocalLinearTrend model
23+
LocalLinearTrend
2424
2525
julia> fit!(model; optimizer = Optimizer(StateSpaceModels.Optim.NelderMead()))
26-
LocalLinearTrend model
26+
LocalLinearTrend
2727
```
2828
"""
2929
function fit!(
@@ -57,9 +57,9 @@ function fit!(
5757
@warn(
5858
"The optimization process converged but the Hessian matrix is not positive definite. " *
5959
"This means that StateSpaceModels.jl cannot estimate the distribution of the hyperparameters " *
60-
"If you are interested in estimates of the distribution of ther hyperparameters we advise you to" *
60+
"If you are interested in estimates of the distribution of ther hyperparameters we advise you to " *
6161
"change the optimization algorithm by using the kwarg fit(...; optimizer = "*
62-
"Optimizer(StateSpaceModels.Optim.THE_METHOD_OF_YOUR_CHOICE()))" *
62+
"Optimizer(StateSpaceModels.Optim.THE_METHOD_OF_YOUR_CHOICE())) " *
6363
"The list of possible algorithms can be found on this link https://julianlsolvers.github.io/Optim.jl/stable/# " *
6464
"otherwise you can simply skip this proccess by using fit(...; save_hyperparameter_distribution=false) "
6565
)

src/hyperparameters.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,18 @@ Fill a model with user inputed initial points for hyperparameter optimzation.
195195
# Example
196196
```jldoctest
197197
julia> model = LocalLevel(rand(100))
198-
LocalLevel model
198+
LocalLevel
199199
200200
julia> get_names(model)
201-
2-element Array{String,1}:
201+
2-element Vector{String}:
202202
"sigma2_ε"
203203
"sigma2_η"
204204
205205
julia> set_initial_hyperparameters!(model, Dict("sigma2_η" => 100.0))
206-
LocalLevel model
206+
LocalLevel
207207
208208
julia> model.hyperparameters.constrained_values
209-
2-element Array{Float64,1}:
209+
2-element Vector{Float64}:
210210
NaN
211211
100.0
212212
```
@@ -257,18 +257,18 @@ the model estimation.
257257
# Example
258258
```jldoctest
259259
julia> model = LocalLevel(rand(100))
260-
LocalLevel model
260+
LocalLevel
261261
262262
julia> get_names(model)
263-
2-element Array{String,1}:
263+
2-element Vector{String}:
264264
"sigma2_ε"
265265
"sigma2_η"
266266
267267
julia> fix_hyperparameters!(model, Dict("sigma2_ε" => 100.0))
268-
LocalLevel model
268+
LocalLevel
269269
270270
julia> model.hyperparameters.fixed_constrained_values
271-
Dict{String,Float64} with 1 entry:
271+
Dict{String, Float64} with 1 entry:
272272
"sigma2_ε" => 100.0
273273
```
274274
"""

src/models/common.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ observations(model::StateSpaceModel) = model.system.y
1010
function lagmat(y::Vector{Fl}, k::Int) where Fl
1111
X = Matrix{Fl}(undef, length(y) - k, k)
1212
for i in 1:k
13-
X[:, i] = lag(y, i)[k + 1:end]
13+
X[:, i] = ShiftedArrays.lag(y, i)[k + 1:end]
1414
end
1515
return X
1616
end

src/models/sarima.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ In terms of a univariate structural model, this can be represented as
8989
# Example
9090
```jldoctest
9191
julia> model = SARIMA(rand(100); order=(1,1,1), seasonal_order=(1,2,3,12))
92-
SARIMA(1, 1, 1)x(1, 2, 3, 12) model
92+
SARIMA(1, 1, 1)x(1, 2, 3, 12) with zero mean
9393
```
9494
9595
See more on [Airline passengers](@ref)

0 commit comments

Comments
 (0)