Skip to content

Commit

Permalink
Merge pull request #29 from fipelle/dev
Browse files Browse the repository at this point in the history
Dev: TSAnalysis.jl => MessyTimeSeries.jl
  • Loading branch information
fipelle authored Nov 27, 2021
2 parents e1b11f1 + fe27fc3 commit 996b928
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
9 changes: 5 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "TSAnalysis"
uuid = "04d71284-fb40-11e9-15e5-dbbde6a47ab4"
version = "0.1.5"
name = "MessyTimeSeries"
uuid = "2a88db5c-15f1-4b3e-a070-d1159e8d76cc"
version = "0.2.0"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand All @@ -18,5 +18,6 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
test = ["Test"]

[compat]
Distributions = "^0"
Distributions = "0.25"
StableRNGs = "1.0"
julia = "1.6"
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# TSAnalysis.jl
```TSAnalysis``` includes basic tools for time series analysis, compatible with incomplete data.
# MessyTimeSeries.jl
```MessyTimeSeries``` includes basic tools for time series analysis, compatible with incomplete data.

```julia
import Pkg;
Pkg.add("TSAnalysis")
Pkg.add("MessyTimeSeries")
```

## Preface
Expand All @@ -25,7 +25,7 @@ Make sure that your FRED API is accessible to ```FredData``` (as in https://gith
To run the examples below, execute first the following block of code:
```julia
using Dates, DataFrames, LinearAlgebra, FredData, Optim, Plots, Measures;
using TSAnalysis;
using MessyTimeSeries;

# Plots backend
plotlyjs();
Expand Down Expand Up @@ -88,7 +88,7 @@ Y = permutedims(Y);

#### Estimation

Suppose that we want to estimate an ARIMA(1,1,1) model for the Industrial Production Index. ```TSAnalysis``` provides a simple interface for that:
Suppose that we want to estimate an ARIMA(1,1,1) model for the Industrial Production Index. ```MessyTimeSeries``` provides a simple interface for that:
```julia
# Estimation settings for an ARIMA(1,1,1)
d = 1;
Expand Down Expand Up @@ -242,7 +242,7 @@ figure[3]
### Kalman filter and smoother

#### Data
The following examples show how to perform a standard univariate state-space decomposition (local linear trend + seasonal + noise decomposition) using the implementations of the Kalman filter and smoother in ```TSAnalysis```. These examples use non-seasonally adjusted (NSA) data that can be downloaded via:
The following examples show how to perform a standard univariate state-space decomposition (local linear trend + seasonal + noise decomposition) using the implementations of the Kalman filter and smoother in ```MessyTimeSeries```. These examples use non-seasonally adjusted (NSA) data that can be downloaded via:
```julia
# Download data of interest
Y_df = download_fred_vintage(["IPGMFN"], ["log"]);
Expand Down Expand Up @@ -284,7 +284,7 @@ trend_llts = hcat(kstatus.history_X_post...)[1,:];
```

#### Kalman filter (out-of-sample forecast)
```TSAnalysis``` allows to compute *h*-step ahead forecasts for the latent states without resetting the Kalman filter. This is particularly efficient for applications wherein the number of observed time periods is particularly large, or for heavy out-of-sample exercises.
```MessyTimeSeries``` allows to compute *h*-step ahead forecasts for the latent states without resetting the Kalman filter. This is particularly efficient for applications wherein the number of observed time periods is particularly large, or for heavy out-of-sample exercises.

An easy way to compute the 12-step ahead prediction is to edit the block
```julia
Expand Down Expand Up @@ -318,7 +318,7 @@ history_Xs, history_Ps, X0s, P0s = ksmoother(ksettings, kstatus);
```

### Estimation of state-space models
State-space models without a high-level interface can be estimated using ```TSAnalysis``` and ```Optim``` jointly.
State-space models without a high-level interface can be estimated using ```MessyTimeSeries``` and ```Optim``` jointly.

The state-space model described in the previous section can be estimated following the steps below.

Expand Down Expand Up @@ -360,7 +360,7 @@ function fmin(θ_unbound, Y; s::Int64=12)
# Apply bounds
θ_bound = copy(θ_unbound);
for i=1:length(θ_bound)
θ_bound[i] = TSAnalysis.get_bounded_log(θ_bound[i], 1e-8);
θ_bound[i] = MessyTimeSeries.get_bounded_log(θ_bound[i], 1e-8);
end

# Compute loglikelihood
Expand All @@ -380,7 +380,7 @@ res = Optim.optimize(θ_unbound->fmin(θ_unbound, Y, s=12), θ_starting, NelderM
# Apply bounds
θ_bound = copy(res.minimizer);
for i=1:length(θ_bound)
θ_bound[i] = TSAnalysis.get_bounded_log(θ_bound[i], 1e-8);
θ_bound[i] = MessyTimeSeries.get_bounded_log(θ_bound[i], 1e-8);
end
```

Expand Down Expand Up @@ -415,7 +415,7 @@ p_slope = plot(Y_df[!,:date], hcat(history_Xs...)[2,:], label="Slope", color=RGB

### Bootstrap and jackknife subsampling

```TSAnalysis``` provides support for the bootstrap and jackknife subsampling methods introduced in Kunsch (1989), Liu and Singh (1992), Pellegrino (2020), Politis and Romano (1994):
```MessyTimeSeries``` provides support for the bootstrap and jackknife subsampling methods introduced in Kunsch (1989), Liu and Singh (1992), Pellegrino (2020), Politis and Romano (1994):

* Artificial delete-*d* jackknife
* Block bootstrap
Expand Down
3 changes: 1 addition & 2 deletions src/TSAnalysis.jl → src/MessyTimeSeries.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__precompile__()

module TSAnalysis
module MessyTimeSeries

# Libraries
using Dates, Distributed, Logging;
Expand All @@ -12,7 +12,6 @@ module TSAnalysis
include("$local_path/methods.jl");
include("$local_path/kalman.jl");
include("$local_path/subsampling.jl");
#include("$local_path/uc_models.jl");

# Export types
export IntVector, IntMatrix, IntArray, FloatVector, FloatMatrix, FloatArray, JVector, JMatrix, JArray, DiagMatrix, SymMatrix,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/tools.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using LinearAlgebra, Test, TSAnalysis;
using LinearAlgebra, Test, MessyTimeSeries;

"""
read_test_input(filepath::String)
Expand Down

0 comments on commit 996b928

Please sign in to comment.