From 2619594f691b96fad890d9abdc56d2ef573cf267 Mon Sep 17 00:00:00 2001 From: Tanguy BARTHELEMY Date: Mon, 6 May 2024 11:10:18 +0200 Subject: [PATCH 1/7] update readme with new link for EUPL --- README.Rmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.Rmd b/README.Rmd index a194f93..f3a675d 100644 --- a/README.Rmd +++ b/README.Rmd @@ -29,7 +29,7 @@ Some quality criteria defined by Wildi and McElroy (2019) can also be computed. ## Installation -rjd3filters relies on the [rJava](https://CRAN.R-project.org/package=rJava) package and running rjd3 packages requires Java 17 or higher. How to set up such a configuration in R is explained [here](https://jdemetra-new-documentation.netlify.app/#installing-the-software) +rjd3filters relies on the [rJava](https://CRAN.R-project.org/package=rJava) package and running rjd3 packages requires Java 17 or higher. How to set up such a configuration in R is explained [here](https://jdemetra-new-documentation.netlify.app/#installing-the-software). @@ -231,4 +231,4 @@ pull requests should include **updated tests** and **updated documentation**. If ## Licensing -The code of this project is licensed under the [European Union Public Licence (EUPL)](https://joinup.ec.europa.eu/page/eupl-text-11-12). +The code of this project is licensed under the [European Union Public Licence (EUPL)](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12). From 1c0e70d4c1f38034878a70fbd2bd97552a6df057 Mon Sep 17 00:00:00 2001 From: Tanguy BARTHELEMY Date: Mon, 6 May 2024 11:10:51 +0200 Subject: [PATCH 2/7] lint space if ( --- R/2_finite_filters.R | 2 +- R/filter.R | 2 +- R/fst_filters.R | 2 +- R/get_properties_function.R | 2 +- R/kernels.R | 4 ++-- R/lp_filters.R | 4 ++-- R/plots.R | 30 +++++++++++++++--------------- R/zzz.R | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/R/2_finite_filters.R b/R/2_finite_filters.R index e8e2134..9fe6b1c 100644 --- a/R/2_finite_filters.R +++ b/R/2_finite_filters.R @@ -100,7 +100,7 @@ finite_filters.matrix <- function(sfilter, rfilters <- rev(rfilters) } } else { - if(first_to_last) { + if (first_to_last) { lfilters <- rev(lfilters) rfilters <- rev(rfilters) } diff --git a/R/filter.R b/R/filter.R index a5ae053..dfcb2ca 100644 --- a/R/filter.R +++ b/R/filter.R @@ -122,7 +122,7 @@ ff_ma <- function(x, coefs, remove_missing = TRUE) { result <- c(rep(NA, data_clean$leading), result, rep(NA, data_clean$trailing)) } - if(is.ts(x)) + if (is.ts(x)) result <- ts(result,start = start(x), frequency = frequency(x)) result } diff --git a/R/fst_filters.R b/R/fst_filters.R index 8322c7e..a9f85d8 100644 --- a/R/fst_filters.R +++ b/R/fst_filters.R @@ -176,7 +176,7 @@ mse.default<-function(aweights, sweights, density=c("uniform", "rw"), passband = } else { sweights <- coef(sweights) } - } else if(length(sweights)>length(aweights)){ + } else if (length(sweights)>length(aweights)){ # we asume sweights were specify from [-n to n] instead of [0,n] n <- (length(sweights)-1)/2 sweights <- sweights[-seq_len(n)] diff --git a/R/get_properties_function.R b/R/get_properties_function.R index 0a96de5..0d949c4 100644 --- a/R/get_properties_function.R +++ b/R/get_properties_function.R @@ -131,7 +131,7 @@ diagnostic_matrix <- function(x, lags, passband = pi/6, results <- c(sum(x)-1, sum(coef(x) * seq(lower_bound(x), upper_bound(x), by = 1)), sum(coef(x) * seq(lower_bound(x), upper_bound(x), by = 1)^2), fst(x, lags, passband = passband)) - if(!missing(sweights)){ + if (!missing(sweights)){ results <- c(results, mse(x, sweights, diff --git a/R/kernels.R b/R/kernels.R index 2a4e7ce..0580420 100644 --- a/R/kernels.R +++ b/R/kernels.R @@ -21,10 +21,10 @@ get_kernel <- function(kernel = c("Henderson","Uniform", "Triangular", choices = c("henderson", "uniform", "triangular", "epanechnikov", "parabolic", "biweight", "triweight", "tricube", "trapezoidal", "gaussian" )) - if(kernel == "parabolic") + if (kernel == "parabolic") kernel <- "epanechnikov" h <- as.integer(horizon) - if(kernel == "gaussian"){ + if (kernel == "gaussian"){ jkernel <- .jcall("jdplus/toolkit/base/core/data/analysis/DiscreteKernel", "Ljava/util/function/IntToDoubleFunction;", tolower(kernel), h, sd_gauss) diff --git a/R/lp_filters.R b/R/lp_filters.R index 8f82eec..57c93cd 100644 --- a/R/lp_filters.R +++ b/R/lp_filters.R @@ -28,7 +28,7 @@ localpolynomials<-function(x, endpoints = c("LC", "QL", "CQ", "CC", "DAF"), ic = 4.5, tweight = 0, passband = pi/12){ - if(2*horizon < degree) + if (2*horizon < degree) stop("You need more observation (2 * horizon + 1) than variables (degree + 1) to estimate the filter.") d <- 2 / (sqrt(pi) * ic) @@ -85,7 +85,7 @@ lp_filter <- function(horizon = 6, degree = 3, endpoints = c("LC", "QL", "CQ", "CC", "DAF", "CN"), ic = 4.5, tweight = 0, passband = pi/12){ - if(2*horizon < degree) + if (2*horizon < degree) stop("You need more observation (2 * horizon + 1) than variables (degree + 1) to estimate the filter.") d <- 2 / (sqrt(pi) * ic) diff --git a/R/plots.R b/R/plots.R index aa01988..9b94497 100644 --- a/R/plots.R +++ b/R/plots.R @@ -31,13 +31,13 @@ plot_coef <- function(x, nxlab = 7, add = FALSE, ...){ plot_coef.default <- function(x, nxlab = 7, add = FALSE, zero_as_na = TRUE, q = 0, legend = FALSE, legend.pos = "topright", ...){ - if(zero_as_na) + if (zero_as_na) x <- apply(x,2, trailingzero_as_na) col_to_plot <- sprintf("q=%i",q) col_to_plot <- col_to_plot[col_to_plot %in% colnames(x)] horizon <- (nrow(x)-1)/2 if (length(col_to_plot) == 0) { - if(!add){ + if (!add){ plot(1, type="n",xaxt = "n", xlab = "", ylab = "coefficient", xlim=c(-horizon, horizon), ylim=c(0, 1), ...) @@ -48,10 +48,10 @@ plot_coef.default <- function(x, nxlab = 7, add = FALSE, matplot(seq(-horizon, horizon, by = 1),x[,col_to_plot], xaxt = "n", xlab = "", type = "o", pch = 20, ylab = "coefficient", add = add, ...) - if(legend) + if (legend) legend(legend.pos,col_to_plot, col = seq_along(col_to_plot), lty=seq_along(col_to_plot), lwd=2) - if(!add) + if (!add) axis(1, at=seq(-horizon, horizon, by = 1), labels = rownames(x)) } @@ -62,7 +62,7 @@ plot_coef.moving_average <- function(x, nxlab = 7, add = FALSE, ...){ matplot(seq(lower_bound(x), upper_bound(x), by = 1), x_plot, xaxt = "n", xlab = "", type = "o", pch = 20, ylab = "coefficient", add = add, ...) - if(!add) + if (!add) axis(1, at=seq(lower_bound(x), upper_bound(x), by = 1), labels = names(x_plot)) } @@ -91,7 +91,7 @@ plot_gain.moving_average<- function(x, nxlab = 7, add = FALSE, plot(g, type = "l", xaxt = "n", xlab = "", ylab = "gain", add = add, xlim = xlim, ...) - if(!add){ + if (!add){ x_lab_at <- seq(xlim[1]/pi, xlim[2]/pi, length.out = nxlab) axis(1, at = x_lab_at * pi, labels = xlabel(x_lab_at)) } @@ -112,7 +112,7 @@ plot_gain.finite_filters <- function(x, nxlab = 7, add = FALSE, all_g_f <- all_g_f[col_to_plot] y_val <- sapply(all_g_f, function(f) f(x_values)) if (length(col_to_plot) == 0) { - if(!add){ + if (!add){ plot(1, type="n",xaxt = "n", xlab = "", ylab = "gain", xlim=xlim, ylim=c(0, 1), ...) @@ -157,7 +157,7 @@ plot_phase.moving_average<- function(x, nxlab = 7, add = FALSE, plot(p_plot, type = "l", xaxt = "n", xlab = "", ylab = "phase", add = add, xlim = xlim, ...) - if(!add){ + if (!add){ x_lab_at <- seq(xlim[1]/pi, xlim[2]/pi, length.out = nxlab) axis(1, at = x_lab_at * pi, labels = xlabel(x_lab_at)) } @@ -180,11 +180,11 @@ plot_phase.finite_filters <- function(x, nxlab = 7, add = FALSE, all_p_f <- all_p_f[col_to_plot] y_val <- sapply(all_p_f, function(f) f(x_values)) - if(normalized){ + if (normalized){ y_val[-1,] <- y_val[-1,] / x_values[-1] } if (length(col_to_plot) == 0) { - if(!add){ + if (!add){ plot(1, type="n",xaxt = "n", xlab = "", ylab = "phase", xlim=xlim, ylim=c(0, 1), ...) @@ -222,7 +222,7 @@ trailingzero_as_na <- function(x){ i <- i - 1 } x - # if(x[length(x)]==0) + # if (x[length(x)]==0) # x [seq(from = tail(which(!sapply(x, function(y) isTRUE(all.equal(y,0)))),1)+1, # to = length(x), # by = 1)] <- NA @@ -237,7 +237,7 @@ rm_leading_zero_or_na <- function(x){ remove_i <- c(i, remove_i) i <- i + 1 } - if(is.null(remove_i)){ + if (is.null(remove_i)){ x } else{ x[-remove_i] @@ -252,7 +252,7 @@ rm_trailing_zero_or_na <- function(x){ remove_i <- c(i, remove_i) i <- i - 1 } - if(is.null(remove_i)){ + if (is.null(remove_i)){ x } else{ x[-remove_i] @@ -267,7 +267,7 @@ rm_trailing_zero <- function(x){ remove_i <- c(i, remove_i) i <- i - 1 } - if(is.null(remove_i)){ + if (is.null(remove_i)){ x } else{ x[-remove_i] @@ -288,7 +288,7 @@ remove_bound_NA <- function(x) { j <- j + 1 } - if(is.null(remove_i_first) & is.null(remove_i_last)){ + if (is.null(remove_i_first) & is.null(remove_i_last)){ # list(data = x, leading = 0, # trailing = 0) } else{ diff --git a/R/zzz.R b/R/zzz.R index e074c91..882fe7e 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -5,7 +5,7 @@ NULL .onLoad <- function(libname, pkgname) { - if (! requireNamespace("rjd3toolkit", quietly = TRUE)) stop("Loading rjd3 libraries failed") + if (!requireNamespace("rjd3toolkit", quietly = TRUE)) stop("Loading rjd3 libraries failed") # For debugts_ging: to see if Jars are effectively loaded # options(java.parameters = "-verbose:class") From a8004b9a132421f54bc0ee4c0ab6861a8fe3435d Mon Sep 17 00:00:00 2001 From: Tanguy BARTHELEMY Date: Mon, 6 May 2024 14:13:28 +0200 Subject: [PATCH 3/7] change rjdemetra3 --> rjd3workspace and rjdemetra --> rjdverse --- NEWS.md | 6 +- README.html | 878 +++++++++++++++++++++++++++++++++++++++++++++++++++ _pkgdown.yml | 2 +- 3 files changed, 882 insertions(+), 4 deletions(-) create mode 100644 README.html diff --git a/NEWS.md b/NEWS.md index 88b39d9..e75b03c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -36,6 +36,6 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). * New Jars -[Unreleased]: https://github.com/rjdemetra/rjd3filters/compare/v2.0.0...HEAD -[2.0.0]: https://github.com/rjdemetra/rjd3filters/releases/tag/v1.0.0...v2.0.0 -[1.0.0]: https://github.com/rjdemetra/rjd3filters/releases/tag/v1.0.0 +[Unreleased]: https://github.com/rjdverse/rjd3filters/compare/v2.0.0...HEAD +[2.0.0]: https://github.com/rjdverse/rjd3filters/releases/tag/v1.0.0...v2.0.0 +[1.0.0]: https://github.com/rjdverse/rjd3filters/releases/tag/v1.0.0 diff --git a/README.html b/README.html new file mode 100644 index 0000000..6266c90 --- /dev/null +++ b/README.html @@ -0,0 +1,878 @@ + + + + + + + + + + + + + + + + + + + + + +

rjd3filters

+

rjd3filters is an R package on linear filters for real-time +trend-cycle estimates. It allows to create symmetric and asymmetric +moving averages with:

+
    +
  • local polynomial filters, as defined by Proietti and Luati +(2008);

  • +
  • the FST approach of Grun-Rehomme, Guggemos, and Ladiray (2018), +based on the optimization of the three criteria Fidelity, Smoothness and +Timeliness;

  • +
  • the Reproducing Kernel Hilbert Space (RKHS) of Dagum and +Bianconcini (2008).

  • +
+

Some quality criteria defined by Wildi and McElroy (2019) can also be +computed.

+

Installation

+

rjd3filters relies on the rJava package.

+

Running rjd3 packages requires Java 17 or higher. +How to set up such a configuration in R is explained here

+

To get the current stable version (from the latest release):

+
# install.packages("remotes")
+remotes::install_github("rjdverse/rjd3toolkit@*release")
+remotes::install_github("rjdverse/rjd3filters@*release")
+

To get the current development version from GitHub:

+
# install.packages("remotes")
+# Install development version from GitHub
+remotes::install_github("rjdverse/rjd3toolkit")
+remotes::install_github("rjdverse/rjd3filters")
+

Basic example

+

In this example we use the same symmetric moving average (Henderson), +but we use three different methods to compute asymmetric filters. As a +consequence, the filtered time series is the same, except at the +boundaries.

+
library("rjd3filters")
+
+y <- window(retailsa$AllOtherGenMerchandiseStores, start = 2000)
+musgrave <- lp_filter(horizon = 6, kernel = "Henderson", endpoints = "LC")
+
+# we put a large weight on the timeliness criteria
+fst_notimeliness_filter <- lapply(0:6, fst_filter, 
+                                  lags = 6, smoothness.weight = 1/1000, 
+                                  timeliness.weight = 1-1/1000, pdegree =2)
+fst_notimeliness <- finite_filters(sfilter = fst_notimeliness_filter[[7]], 
+                                   rfilters = fst_notimeliness_filter[-7], 
+                                   first_to_last = TRUE)
+# RKHS filters minimizing timeliness
+rkhs_timeliness <- rkhs_filter(horizon = 6, asymmetricCriterion = "Timeliness")
+
+trend_musgrave <- filter(y, musgrave)
+trend_fst <- filter(y, fst_notimeliness)
+trend_rkhs <- filter(y, rkhs_timeliness)
+plot(ts.union(y, trend_musgrave, trend_fst, trend_rkhs), plot.type = "single", 
+     col = c("black", "orange", "lightblue", "red"), 
+     main = "Filtered time series", ylab=NULL)
+legend("topleft", legend = c("y", "Musgrave", "FST", "RKHS"), 
+       col= c("black", "orange", "lightblue", "red"), lty = 1)
+ + +

The last estimates can also be analysed with the +implicit_forecast function that retreive the implicit +forecasts corresponding to the asymmetric filters (i.e., the forecasts +needed to have the same end-points estimates but using the symmetric +filter).

+
f_musgrave <- implicit_forecast(y, musgrave)
+f_fst <- implicit_forecast(y, fst_notimeliness)
+f_rkhs <- implicit_forecast(y, rkhs_timeliness)
+
+plot(window(y, start = 2007), 
+     xlim = c(2007, 2012), ylim = c(3600, 4600), 
+     main = "Last estimates and implicit forecast", ylab=NULL)
+lines(trend_musgrave, 
+      col = "orange")
+lines(trend_fst, 
+      col = "lightblue")
+lines(trend_rkhs, 
+      col = "red")
+lines(ts(c(tail(y, 1), f_musgrave), frequency = frequency(y), start = end(y)), 
+      col = "orange", lty = 2)
+lines(ts(c(tail(y, 1), f_fst), frequency = frequency(y), start = end(y)), 
+      col = "lightblue", lty = 2)
+lines(ts(c(tail(y, 1), f_rkhs), frequency = frequency(y), start = end(y)), 
+      col = "red", lty = 2)
+legend("topleft", legend = c("y", "Musgrave", "FST", "RKHS", "Forecasts"), 
+       col= c("black", "orange", "lightblue", "red", "black"), 
+       lty = c(1, 1, 1, 1, 2))
+ + +

The real-time estimates (when no future points are available) can +also be compared:

+
trend_henderson<- filter(y, musgrave[, "q=6"])
+trend_musgrave_q0 <- filter(y, musgrave[, "q=0"])
+trend_fst_q0 <- filter(y, fst_notimeliness[, "q=0"])
+trend_rkhs_q0 <- filter(y, rkhs_timeliness[, "q=0"])
+plot(window(ts.union(y, trend_musgrave_q0, trend_fst_q0, trend_rkhs_q0), 
+            start = 2007), 
+     plot.type = "single", 
+     col = c("black", "orange", "lightblue", "red"), 
+     main = "Real time estimates of the trend", ylab=NULL)
+legend("topleft", legend = c("y", "Musgrave", "FST", "RKHS"), 
+       col= c("black", "orange", "lightblue", "red"), lty = 1)
+ + +

Comparison of the filters

+

Different quality criteria from Grun-Rehomme et al (2018) +and Wildi and McElroy(2019) can also be computed with the function +diagnostic_matrix():

+
q_0_coefs <- list(Musgrave = musgrave[, "q=0"], 
+                  fst_notimeliness = fst_notimeliness[, "q=0"], 
+                  rkhs_timeliness = rkhs_timeliness[, "q=0"])
+
+sapply(X = q_0_coefs, 
+       FUN = diagnostic_matrix, 
+       lags = 6, 
+       sweights = musgrave[, "q=6"])
+#>         Musgrave fst_notimeliness rkhs_timeliness
+#> b_c  0.000000000     2.220446e-16     0.000000000
+#> b_l -0.575984377    -1.554312e-15    -0.611459167
+#> b_q -1.144593858     1.554312e-15     0.027626749
+#> F_g  0.357509832     9.587810e-01     0.381135700
+#> S_g  1.137610871     2.402400e+00     1.207752284
+#> T_g  0.034088260     4.676398e-04     0.023197411
+#> A_w  0.008306348     1.823745e-02     0.003677964
+#> S_w  0.449956378     3.575634e+00     0.628156109
+#> T_w  0.061789932     7.940547e-04     0.043540181
+#> R_w  0.299548665     1.721377e-01     0.219948644
+

The filters can also be compared by plotting there coefficients +(plot_coef), gain function (plot_gain) and +phase function (plot_phase):

+
def.par <- par(no.readonly = TRUE)
+par(mai = c(0.3, 0.3, 0.2, 0))
+layout(matrix(c(1, 1, 2, 3), 2, 2, byrow = TRUE))
+
+plot_coef(fst_notimeliness, q = 0, col = "lightblue")
+plot_coef(musgrave, q = 0, add = TRUE, col = "orange")
+plot_coef(rkhs_timeliness, q = 0, add = TRUE, col = "red")
+legend("topleft", legend = c("Musgrave", "FST", "RKHS"), 
+       col= c("orange", "lightblue", "red"), lty = 1)
+
+plot_gain(fst_notimeliness, q = 0, col = "lightblue")
+plot_gain(musgrave, q = 0, col = "orange", add = TRUE)
+plot_gain(rkhs_timeliness, q = 0, add = TRUE, col = "red")
+legend("topright", legend = c("Musgrave", "FST", "RKHS"), 
+       col= c("orange", "lightblue", "red"), lty = 1)
+
+plot_phase(fst_notimeliness, q = 0, col = "lightblue")
+plot_phase(musgrave, q = 0, col = "orange", add = TRUE)
+plot_phase(rkhs_timeliness, q = 0, add = TRUE, col = "red")
+legend("topright", legend = c("Musgrave", "FST", "RKHS"), 
+       col= c("orange", "lightblue", "red"), lty = 1)
+par(def.par)
+ + +

Confidence intervals can also be computed with the +confint_filter function:

+
confint <- confint_filter(y, musgrave)
+
+plot(confint, plot.type = "single",
+     col = c("red", "black", "black"),
+     lty = c(1, 2, 2), xlab = NULL, ylab = NULL)
+lines(y, col = "grey")
+legend("topleft", legend = c("y", "Smoothed", "CI (95%)"), 
+       col= c("grey", "red", "black"), lty = c(1, 1, 2))
+ + +

Manipulate moving averages

+

You can also create and manipulate moving averages with the class +moving_average. In the next examples we show how to create +the M2X12 moving average, the first moving average used to extract the +trend-cycle in X-11, and the M3X3 moving average, applied to each months +to extract seasonal component.

+
e1 <- moving_average(rep(1, 12), lags = -6)
+e1 <- e1/sum(e1)
+e2 <- moving_average(rep(1/12, 12), lags = -5)
+M2X12 <- (e1 + e2)/2
+coef(M2X12)
+#>        t-6        t-5        t-4        t-3        t-2        t-1          t 
+#> 0.04166667 0.08333333 0.08333333 0.08333333 0.08333333 0.08333333 0.08333333 
+#>        t+1        t+2        t+3        t+4        t+5        t+6 
+#> 0.08333333 0.08333333 0.08333333 0.08333333 0.08333333 0.04166667
+M3 <- moving_average(rep(1/3, 3), lags = -1)
+M3X3 <- M3 * M3
+# M3X3 moving average applied to each month
+M3X3
+#> [1] "0.1111 B^2 + 0.2222 B + 0.3333 + 0.2222 F + 0.1111 F^2"
+M3X3_seasonal <- to_seasonal(M3X3, 12)
+# M3X3_seasonal moving average applied to the global series
+M3X3_seasonal
+#> [1] "0.1111 B^24 + 0.2222 B^12 + 0.3333 + 0.2222 F^12 + 0.1111 F^24"
+
+def.par <- par(no.readonly = TRUE)
+par(mai = c(0.5, 0.8, 0.3, 0))
+layout(matrix(c(1, 2), nrow = 1))
+plot_gain(M3X3, main = "M3X3 applied to each month")
+plot_gain(M3X3_seasonal, main = "M3X3 applied to the global series")
+ + +
par(def.par)
+
+# To apply the moving average
+t <- y * M2X12
+si <- y - t
+s <- si * M3X3_seasonal
+# or equivalently:
+s_mm <- M3X3_seasonal * (1 - M2X12)
+s <- y * s_mm
+

Manipulate finite filters

+

finite_filters object are a combination of a central +filter (used for the final estimates) and different asymmetric filters +used for intermediate estimates at the beginning/end of the series when +the central filter cannot be applied.

+
musgrave 
+#>             q=6          q=5          q=4          q=3          q=2
+#> t-6 -0.01934985 -0.016609040 -0.011623676 -0.009152423 -0.016139228
+#> t-5 -0.02786378 -0.025914479 -0.022541271 -0.020981640 -0.024948087
+#> t-4  0.00000000  0.001157790  0.002918842  0.003566851  0.002620762
+#> t-3  0.06549178  0.065858066  0.066006963  0.065743350  0.067817618
+#> t-2  0.14735651  0.146931288  0.145468029  0.144292794  0.149387420
+#> t-1  0.21433675  0.213120014  0.210044599  0.207957742  0.216072726
+#> t    0.24005716  0.238048915  0.233361346  0.230362866  0.241498208
+#>              q=1         q=0
+#> t-6 -0.037925830 -0.07371504
+#> t-5 -0.035216813 -0.04601336
+#> t-4  0.003869912  0.01806602
+#> t-3  0.080584644  0.11977342
+#> t-2  0.173672322  0.23785375
+#> t-1  0.251875504  0.34104960
+#> t    0.288818862  0.40298562
+#>  [ getOption("max.print") est atteint -- 6 lignes omises ]
+musgrave * M3X3
+#>              q=6          q=5          q=4           q=3          q=2
+#> t-8 -0.002149983 -0.001845449 -0.001291520 -0.0010169359 -0.001793248
+#> t-7 -0.007395941 -0.006570284 -0.005087625 -0.0043651651 -0.006358505
+#> t-6 -0.012641899 -0.011166476 -0.008559414 -0.0073170774 -0.010632566
+#> t-5 -0.006311026 -0.004754208 -0.002114058 -0.0009303015 -0.003784842
+#> t-4  0.022584742  0.023742532  0.025503585  0.0261515939  0.025205505
+#> t-3  0.075295705  0.075661988  0.075810884  0.0755472713  0.077621540
+#> t-2  0.137975973  0.137550748  0.136087489  0.1349122536  0.140006880
+#>              q=1         q=0
+#> t-8 -0.004213981 -0.00819056
+#> t-7 -0.012340941 -0.02149372
+#> t-6 -0.020037912 -0.03278954
+#> t-5 -0.010353070 -0.01439608
+#> t-4  0.026454654  0.04065076
+#> t-3  0.090388566  0.12957734
+#> t-2  0.164291782  0.22847321
+#>  [ getOption("max.print") est atteint -- 10 lignes omises ]
+

Bibliography

+

Dagum, Estela Bee and Silvia Bianconcini (2008). “The Henderson +Smoother in Reproducing Kernel Hilbert Space”. In: Journal of +Business & Economic Statistics 26, pp. 536–545. URL: https://ideas.repec.org/a/bes/jnlbes/v26y2008p536-545.html.

+

Grun-Rehomme, Michel, Fabien Guggemos, and Dominique Ladiray (2018). +“Asymmetric Moving Averages Minimizing Phase Shift”. In: Handbook on +Seasonal Adjustment. URL: https://ec.europa.eu/eurostat/web/products-manuals-and-guidelines/-/KS-GQ-18-001.

+

Proietti, Tommaso and Alessandra Luati (Dec. 2008). “Real time +estimation in local polynomial regression, with application to +trend-cycle analysis”. In: Ann. Appl. Stat. 2.4, pp. 1523–1553. +URL: https://doi.org/10.1214/08-AOAS195.

+

Wildi, Marc and Tucker McElroy (2019). “The trilemma between +accuracy, timeliness and smoothness in real-time signal extraction”. In: +International Journal of Forecasting 35.3, pp. 1072–1084. URL: +https://EconPapers.repec.org/RePEc:eee:intfor:v:35:y:2019:i:3:p:1072-1084.

+

Package Maintenance and +contributing

+

Any contribution is welcome and should be done through pull requests +and/or issues. pull requests should include updated +tests and updated documentation. If +functionality is changed, docstrings should be added or updated.

+

Licensing

+

The code of this project is licensed under the European +Union Public Licence (EUPL).

+ + + diff --git a/_pkgdown.yml b/_pkgdown.yml index b479540..2dd69de 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,4 +1,4 @@ -url: https://rjdemetra.github.io/rjd3filters/ +url: https://rjdverse.github.io/rjd3filters/ template: bootstrap: 5 From b121cd317f82008f484aeeef88d6608c3d0cebb3 Mon Sep 17 00:00:00 2001 From: Tanguy BARTHELEMY Date: Tue, 7 May 2024 14:21:07 +0200 Subject: [PATCH 4/7] harmonisation of .gitignore and .Rbuildignore --- .Rbuildignore | 34 +- .gitignore | 56 +++- README.html | 878 -------------------------------------------------- 3 files changed, 72 insertions(+), 896 deletions(-) delete mode 100644 README.html diff --git a/.Rbuildignore b/.Rbuildignore index 55b2e91..89416d3 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,19 +1,27 @@ -^appveyor\.yml$ -^docs$ -^_pkgdown\.yml$ ^.*\.Rproj$ ^\.Rproj\.user$ -^.lintr$ -^README.Rmd$ + +^\.git$ +^\.github$ + +^README\.Rmd$ ^README-.*\.png$ -.travis.yml -^pkgdown$ + +^Meta$ +^docs$ ^doc$ +^pkgdown$ +^_pkgdown\.yml$ + +^\.lintr$ + +^appveyor\.yml$ +.travis.yml + cran-comments.md -TODO.R + +^\.DS_Store$ + ^revdep$ -workspace -workspace.xml -R/test_X11.R -^\.github$ -^LICENSE$ +^reconf\.sh$ +^rjd3toolkit-java-deps\.xml$ diff --git a/.gitignore b/.gitignore index ee10e6d..de7c8b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,55 @@ -.Rproj.user +# History files .Rhistory +.Rapp.history + +# Session Data files .RData +.RDataTmp + +# User-specific files .Ruserdata + +# Example code in package build process +*-Ex.R + +# Output files from R CMD build +/*.tar.gz + +# Output files from R CMD check +/*.Rcheck/ + +# RStudio files +.Rproj.user/ + +# produced vignettes +vignettes/*.html +vignettes/*.pdf +Meta/ +inst/doc/ +doc/ + +# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 +.httr-oauth + +# knitr and R markdown default cache directories +*_cache/ +/cache/ + +# Temporary files created by R markdown +*.utf8.md +*.knit.md + +# R Environment Variables +.Renviron + +# pkgdown site +docs/ + +# translation temp files +po/*~ + +# RStudio Connect folder +rsconnect/ + +# Hidden file from mac-os .DS_Store -workspace -workspace.xml -inst/doc -docs diff --git a/README.html b/README.html deleted file mode 100644 index 6266c90..0000000 --- a/README.html +++ /dev/null @@ -1,878 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -

rjd3filters

-

rjd3filters is an R package on linear filters for real-time -trend-cycle estimates. It allows to create symmetric and asymmetric -moving averages with:

-
    -
  • local polynomial filters, as defined by Proietti and Luati -(2008);

  • -
  • the FST approach of Grun-Rehomme, Guggemos, and Ladiray (2018), -based on the optimization of the three criteria Fidelity, Smoothness and -Timeliness;

  • -
  • the Reproducing Kernel Hilbert Space (RKHS) of Dagum and -Bianconcini (2008).

  • -
-

Some quality criteria defined by Wildi and McElroy (2019) can also be -computed.

-

Installation

-

rjd3filters relies on the rJava package.

-

Running rjd3 packages requires Java 17 or higher. -How to set up such a configuration in R is explained here

-

To get the current stable version (from the latest release):

-
# install.packages("remotes")
-remotes::install_github("rjdverse/rjd3toolkit@*release")
-remotes::install_github("rjdverse/rjd3filters@*release")
-

To get the current development version from GitHub:

-
# install.packages("remotes")
-# Install development version from GitHub
-remotes::install_github("rjdverse/rjd3toolkit")
-remotes::install_github("rjdverse/rjd3filters")
-

Basic example

-

In this example we use the same symmetric moving average (Henderson), -but we use three different methods to compute asymmetric filters. As a -consequence, the filtered time series is the same, except at the -boundaries.

-
library("rjd3filters")
-
-y <- window(retailsa$AllOtherGenMerchandiseStores, start = 2000)
-musgrave <- lp_filter(horizon = 6, kernel = "Henderson", endpoints = "LC")
-
-# we put a large weight on the timeliness criteria
-fst_notimeliness_filter <- lapply(0:6, fst_filter, 
-                                  lags = 6, smoothness.weight = 1/1000, 
-                                  timeliness.weight = 1-1/1000, pdegree =2)
-fst_notimeliness <- finite_filters(sfilter = fst_notimeliness_filter[[7]], 
-                                   rfilters = fst_notimeliness_filter[-7], 
-                                   first_to_last = TRUE)
-# RKHS filters minimizing timeliness
-rkhs_timeliness <- rkhs_filter(horizon = 6, asymmetricCriterion = "Timeliness")
-
-trend_musgrave <- filter(y, musgrave)
-trend_fst <- filter(y, fst_notimeliness)
-trend_rkhs <- filter(y, rkhs_timeliness)
-plot(ts.union(y, trend_musgrave, trend_fst, trend_rkhs), plot.type = "single", 
-     col = c("black", "orange", "lightblue", "red"), 
-     main = "Filtered time series", ylab=NULL)
-legend("topleft", legend = c("y", "Musgrave", "FST", "RKHS"), 
-       col= c("black", "orange", "lightblue", "red"), lty = 1)
- - -

The last estimates can also be analysed with the -implicit_forecast function that retreive the implicit -forecasts corresponding to the asymmetric filters (i.e., the forecasts -needed to have the same end-points estimates but using the symmetric -filter).

-
f_musgrave <- implicit_forecast(y, musgrave)
-f_fst <- implicit_forecast(y, fst_notimeliness)
-f_rkhs <- implicit_forecast(y, rkhs_timeliness)
-
-plot(window(y, start = 2007), 
-     xlim = c(2007, 2012), ylim = c(3600, 4600), 
-     main = "Last estimates and implicit forecast", ylab=NULL)
-lines(trend_musgrave, 
-      col = "orange")
-lines(trend_fst, 
-      col = "lightblue")
-lines(trend_rkhs, 
-      col = "red")
-lines(ts(c(tail(y, 1), f_musgrave), frequency = frequency(y), start = end(y)), 
-      col = "orange", lty = 2)
-lines(ts(c(tail(y, 1), f_fst), frequency = frequency(y), start = end(y)), 
-      col = "lightblue", lty = 2)
-lines(ts(c(tail(y, 1), f_rkhs), frequency = frequency(y), start = end(y)), 
-      col = "red", lty = 2)
-legend("topleft", legend = c("y", "Musgrave", "FST", "RKHS", "Forecasts"), 
-       col= c("black", "orange", "lightblue", "red", "black"), 
-       lty = c(1, 1, 1, 1, 2))
- - -

The real-time estimates (when no future points are available) can -also be compared:

-
trend_henderson<- filter(y, musgrave[, "q=6"])
-trend_musgrave_q0 <- filter(y, musgrave[, "q=0"])
-trend_fst_q0 <- filter(y, fst_notimeliness[, "q=0"])
-trend_rkhs_q0 <- filter(y, rkhs_timeliness[, "q=0"])
-plot(window(ts.union(y, trend_musgrave_q0, trend_fst_q0, trend_rkhs_q0), 
-            start = 2007), 
-     plot.type = "single", 
-     col = c("black", "orange", "lightblue", "red"), 
-     main = "Real time estimates of the trend", ylab=NULL)
-legend("topleft", legend = c("y", "Musgrave", "FST", "RKHS"), 
-       col= c("black", "orange", "lightblue", "red"), lty = 1)
- - -

Comparison of the filters

-

Different quality criteria from Grun-Rehomme et al (2018) -and Wildi and McElroy(2019) can also be computed with the function -diagnostic_matrix():

-
q_0_coefs <- list(Musgrave = musgrave[, "q=0"], 
-                  fst_notimeliness = fst_notimeliness[, "q=0"], 
-                  rkhs_timeliness = rkhs_timeliness[, "q=0"])
-
-sapply(X = q_0_coefs, 
-       FUN = diagnostic_matrix, 
-       lags = 6, 
-       sweights = musgrave[, "q=6"])
-#>         Musgrave fst_notimeliness rkhs_timeliness
-#> b_c  0.000000000     2.220446e-16     0.000000000
-#> b_l -0.575984377    -1.554312e-15    -0.611459167
-#> b_q -1.144593858     1.554312e-15     0.027626749
-#> F_g  0.357509832     9.587810e-01     0.381135700
-#> S_g  1.137610871     2.402400e+00     1.207752284
-#> T_g  0.034088260     4.676398e-04     0.023197411
-#> A_w  0.008306348     1.823745e-02     0.003677964
-#> S_w  0.449956378     3.575634e+00     0.628156109
-#> T_w  0.061789932     7.940547e-04     0.043540181
-#> R_w  0.299548665     1.721377e-01     0.219948644
-

The filters can also be compared by plotting there coefficients -(plot_coef), gain function (plot_gain) and -phase function (plot_phase):

-
def.par <- par(no.readonly = TRUE)
-par(mai = c(0.3, 0.3, 0.2, 0))
-layout(matrix(c(1, 1, 2, 3), 2, 2, byrow = TRUE))
-
-plot_coef(fst_notimeliness, q = 0, col = "lightblue")
-plot_coef(musgrave, q = 0, add = TRUE, col = "orange")
-plot_coef(rkhs_timeliness, q = 0, add = TRUE, col = "red")
-legend("topleft", legend = c("Musgrave", "FST", "RKHS"), 
-       col= c("orange", "lightblue", "red"), lty = 1)
-
-plot_gain(fst_notimeliness, q = 0, col = "lightblue")
-plot_gain(musgrave, q = 0, col = "orange", add = TRUE)
-plot_gain(rkhs_timeliness, q = 0, add = TRUE, col = "red")
-legend("topright", legend = c("Musgrave", "FST", "RKHS"), 
-       col= c("orange", "lightblue", "red"), lty = 1)
-
-plot_phase(fst_notimeliness, q = 0, col = "lightblue")
-plot_phase(musgrave, q = 0, col = "orange", add = TRUE)
-plot_phase(rkhs_timeliness, q = 0, add = TRUE, col = "red")
-legend("topright", legend = c("Musgrave", "FST", "RKHS"), 
-       col= c("orange", "lightblue", "red"), lty = 1)
-par(def.par)
- - -

Confidence intervals can also be computed with the -confint_filter function:

-
confint <- confint_filter(y, musgrave)
-
-plot(confint, plot.type = "single",
-     col = c("red", "black", "black"),
-     lty = c(1, 2, 2), xlab = NULL, ylab = NULL)
-lines(y, col = "grey")
-legend("topleft", legend = c("y", "Smoothed", "CI (95%)"), 
-       col= c("grey", "red", "black"), lty = c(1, 1, 2))
- - -

Manipulate moving averages

-

You can also create and manipulate moving averages with the class -moving_average. In the next examples we show how to create -the M2X12 moving average, the first moving average used to extract the -trend-cycle in X-11, and the M3X3 moving average, applied to each months -to extract seasonal component.

-
e1 <- moving_average(rep(1, 12), lags = -6)
-e1 <- e1/sum(e1)
-e2 <- moving_average(rep(1/12, 12), lags = -5)
-M2X12 <- (e1 + e2)/2
-coef(M2X12)
-#>        t-6        t-5        t-4        t-3        t-2        t-1          t 
-#> 0.04166667 0.08333333 0.08333333 0.08333333 0.08333333 0.08333333 0.08333333 
-#>        t+1        t+2        t+3        t+4        t+5        t+6 
-#> 0.08333333 0.08333333 0.08333333 0.08333333 0.08333333 0.04166667
-M3 <- moving_average(rep(1/3, 3), lags = -1)
-M3X3 <- M3 * M3
-# M3X3 moving average applied to each month
-M3X3
-#> [1] "0.1111 B^2 + 0.2222 B + 0.3333 + 0.2222 F + 0.1111 F^2"
-M3X3_seasonal <- to_seasonal(M3X3, 12)
-# M3X3_seasonal moving average applied to the global series
-M3X3_seasonal
-#> [1] "0.1111 B^24 + 0.2222 B^12 + 0.3333 + 0.2222 F^12 + 0.1111 F^24"
-
-def.par <- par(no.readonly = TRUE)
-par(mai = c(0.5, 0.8, 0.3, 0))
-layout(matrix(c(1, 2), nrow = 1))
-plot_gain(M3X3, main = "M3X3 applied to each month")
-plot_gain(M3X3_seasonal, main = "M3X3 applied to the global series")
- - -
par(def.par)
-
-# To apply the moving average
-t <- y * M2X12
-si <- y - t
-s <- si * M3X3_seasonal
-# or equivalently:
-s_mm <- M3X3_seasonal * (1 - M2X12)
-s <- y * s_mm
-

Manipulate finite filters

-

finite_filters object are a combination of a central -filter (used for the final estimates) and different asymmetric filters -used for intermediate estimates at the beginning/end of the series when -the central filter cannot be applied.

-
musgrave 
-#>             q=6          q=5          q=4          q=3          q=2
-#> t-6 -0.01934985 -0.016609040 -0.011623676 -0.009152423 -0.016139228
-#> t-5 -0.02786378 -0.025914479 -0.022541271 -0.020981640 -0.024948087
-#> t-4  0.00000000  0.001157790  0.002918842  0.003566851  0.002620762
-#> t-3  0.06549178  0.065858066  0.066006963  0.065743350  0.067817618
-#> t-2  0.14735651  0.146931288  0.145468029  0.144292794  0.149387420
-#> t-1  0.21433675  0.213120014  0.210044599  0.207957742  0.216072726
-#> t    0.24005716  0.238048915  0.233361346  0.230362866  0.241498208
-#>              q=1         q=0
-#> t-6 -0.037925830 -0.07371504
-#> t-5 -0.035216813 -0.04601336
-#> t-4  0.003869912  0.01806602
-#> t-3  0.080584644  0.11977342
-#> t-2  0.173672322  0.23785375
-#> t-1  0.251875504  0.34104960
-#> t    0.288818862  0.40298562
-#>  [ getOption("max.print") est atteint -- 6 lignes omises ]
-musgrave * M3X3
-#>              q=6          q=5          q=4           q=3          q=2
-#> t-8 -0.002149983 -0.001845449 -0.001291520 -0.0010169359 -0.001793248
-#> t-7 -0.007395941 -0.006570284 -0.005087625 -0.0043651651 -0.006358505
-#> t-6 -0.012641899 -0.011166476 -0.008559414 -0.0073170774 -0.010632566
-#> t-5 -0.006311026 -0.004754208 -0.002114058 -0.0009303015 -0.003784842
-#> t-4  0.022584742  0.023742532  0.025503585  0.0261515939  0.025205505
-#> t-3  0.075295705  0.075661988  0.075810884  0.0755472713  0.077621540
-#> t-2  0.137975973  0.137550748  0.136087489  0.1349122536  0.140006880
-#>              q=1         q=0
-#> t-8 -0.004213981 -0.00819056
-#> t-7 -0.012340941 -0.02149372
-#> t-6 -0.020037912 -0.03278954
-#> t-5 -0.010353070 -0.01439608
-#> t-4  0.026454654  0.04065076
-#> t-3  0.090388566  0.12957734
-#> t-2  0.164291782  0.22847321
-#>  [ getOption("max.print") est atteint -- 10 lignes omises ]
-

Bibliography

-

Dagum, Estela Bee and Silvia Bianconcini (2008). “The Henderson -Smoother in Reproducing Kernel Hilbert Space”. In: Journal of -Business & Economic Statistics 26, pp. 536–545. URL: https://ideas.repec.org/a/bes/jnlbes/v26y2008p536-545.html.

-

Grun-Rehomme, Michel, Fabien Guggemos, and Dominique Ladiray (2018). -“Asymmetric Moving Averages Minimizing Phase Shift”. In: Handbook on -Seasonal Adjustment. URL: https://ec.europa.eu/eurostat/web/products-manuals-and-guidelines/-/KS-GQ-18-001.

-

Proietti, Tommaso and Alessandra Luati (Dec. 2008). “Real time -estimation in local polynomial regression, with application to -trend-cycle analysis”. In: Ann. Appl. Stat. 2.4, pp. 1523–1553. -URL: https://doi.org/10.1214/08-AOAS195.

-

Wildi, Marc and Tucker McElroy (2019). “The trilemma between -accuracy, timeliness and smoothness in real-time signal extraction”. In: -International Journal of Forecasting 35.3, pp. 1072–1084. URL: -https://EconPapers.repec.org/RePEc:eee:intfor:v:35:y:2019:i:3:p:1072-1084.

-

Package Maintenance and -contributing

-

Any contribution is welcome and should be done through pull requests -and/or issues. pull requests should include updated -tests and updated documentation. If -functionality is changed, docstrings should be added or updated.

-

Licensing

-

The code of this project is licensed under the European -Union Public Licence (EUPL).

- - - From 9469fa32f9d8c624cffb37153918aae329897fa5 Mon Sep 17 00:00:00 2001 From: Tanguy BARTHELEMY Date: Wed, 15 May 2024 11:49:02 +0200 Subject: [PATCH 5/7] Remove automarted coverage test (currently useless) --- .github/workflows/test-coverage.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 7d814af..972fad9 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -1,10 +1,7 @@ # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: - push: - branches: [main, develop] - pull_request: - branches: [main, develop] + workflow_dispatch name: test-coverage From c3f12fc7944db459d16d4b3b5c6211c3ca5d9119 Mon Sep 17 00:00:00 2001 From: Tanguy BARTHELEMY Date: Thu, 16 May 2024 16:05:55 +0200 Subject: [PATCH 6/7] Add pom.xml to .RBuildIgnore and the produced README.html to .gitignore --- .Rbuildignore | 2 +- .gitignore | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.Rbuildignore b/.Rbuildignore index 89416d3..6e0d1c5 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -24,4 +24,4 @@ cran-comments.md ^revdep$ ^reconf\.sh$ -^rjd3toolkit-java-deps\.xml$ +^pom\.xml$ diff --git a/.gitignore b/.gitignore index de7c8b2..11424ef 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,6 @@ rsconnect/ # Hidden file from mac-os .DS_Store + +# produced README.html +README.html From 3680f16aa0cb8632dc22a8068b2033f5f19f962a Mon Sep 17 00:00:00 2001 From: Tanguy BARTHELEMY Date: Tue, 21 May 2024 09:50:58 +0200 Subject: [PATCH 7/7] Correct bug in specifying the maximu line number to print --- README.Rmd | 3 ++- README.md | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/README.Rmd b/README.Rmd index 5f8f4cc..61c6cc1 100644 --- a/README.Rmd +++ b/README.Rmd @@ -10,8 +10,9 @@ knitr::opts_chunk$set( comment = "#>", fig.path = "man/figures/README-", fig.align="center", - fig.width = 8 + fig.width = 8L ) +options(max.print = 1000L) ``` # rjd3filters diff --git a/README.md b/README.md index 018c102..e5da835 100644 --- a/README.md +++ b/README.md @@ -272,6 +272,12 @@ musgrave #> t-2 0.14735651 0.146931288 0.145468029 0.144292794 0.149387420 #> t-1 0.21433675 0.213120014 0.210044599 0.207957742 0.216072726 #> t 0.24005716 0.238048915 0.233361346 0.230362866 0.241498208 +#> t+1 0.21433675 0.211536998 0.205237273 0.201327171 0.215482871 +#> t+2 0.14735651 0.143765257 0.135853376 0.131031652 0.148207710 +#> t+3 0.06549178 0.061109020 0.051584983 0.045851637 0.000000000 +#> t+4 0.00000000 -0.005174272 -0.016310464 0.000000000 0.000000000 +#> t+5 -0.02786378 -0.033829557 0.000000000 0.000000000 0.000000000 +#> t+6 -0.01934985 0.000000000 0.000000000 0.000000000 0.000000000 #> q=1 q=0 #> t-6 -0.037925830 -0.07371504 #> t-5 -0.035216813 -0.04601336 @@ -280,7 +286,12 @@ musgrave #> t-2 0.173672322 0.23785375 #> t-1 0.251875504 0.34104960 #> t 0.288818862 0.40298562 -#> [ getOption("max.print") est atteint -- 6 lignes omises ] +#> t+1 0.274321400 0.00000000 +#> t+2 0.000000000 0.00000000 +#> t+3 0.000000000 0.00000000 +#> t+4 0.000000000 0.00000000 +#> t+5 0.000000000 0.00000000 +#> t+6 0.000000000 0.00000000 musgrave * M3X3 #> q=6 q=5 q=4 q=3 q=2 #> t-8 -0.002149983 -0.001845449 -0.001291520 -0.0010169359 -0.001793248 @@ -290,6 +301,16 @@ musgrave * M3X3 #> t-4 0.022584742 0.023742532 0.025503585 0.0261515939 0.025205505 #> t-3 0.075295705 0.075661988 0.075810884 0.0755472713 0.077621540 #> t-2 0.137975973 0.137550748 0.136087489 0.1349122536 0.140006880 +#> t-1 0.188629568 0.187412835 0.184337420 0.1822505629 0.190365547 +#> t 0.208025720 0.206017479 0.201329910 0.1983314300 0.209466772 +#> t+1 0.188629568 0.185829819 0.179530094 0.1756199919 0.182437019 +#> t+2 0.137975973 0.134384717 0.126472836 0.1242017153 0.124120786 +#> t+3 0.075295705 0.070912941 0.066564227 0.0667717095 0.056877588 +#> t+4 0.022584742 0.020311263 0.021121328 0.0247483251 0.016467523 +#> t+5 -0.006311026 -0.005636466 0.002107117 0.0050946263 0.000000000 +#> t+6 -0.012641899 -0.008092598 -0.001812274 0.0000000000 0.000000000 +#> t+7 -0.007395941 -0.003758840 0.000000000 0.0000000000 0.000000000 +#> t+8 -0.002149983 0.000000000 0.000000000 0.0000000000 0.000000000 #> q=1 q=0 #> t-8 -0.004213981 -0.00819056 #> t-7 -0.012340941 -0.02149372 @@ -298,7 +319,16 @@ musgrave * M3X3 #> t-4 0.026454654 0.04065076 #> t-3 0.090388566 0.12957734 #> t-2 0.164291782 0.22847321 -#> [ getOption("max.print") est atteint -- 10 lignes omises ] +#> t-1 0.226168325 0.26940011 +#> t 0.232502524 0.23654553 +#> t+1 0.183608603 0.12744676 +#> t+2 0.093051296 0.04477618 +#> t+3 0.030480156 0.00000000 +#> t+4 0.000000000 0.00000000 +#> t+5 0.000000000 0.00000000 +#> t+6 0.000000000 0.00000000 +#> t+7 0.000000000 0.00000000 +#> t+8 0.000000000 0.00000000 ``` ## Bibliography