diff --git a/DESCRIPTION b/DESCRIPTION index 38e55d1..79f226e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -31,7 +31,8 @@ Imports: stats, utils Suggests: - spelling + spelling, + knitr VignetteBuilder: knitr Encoding: UTF-8 diff --git a/R/display.R b/R/display.R index 15518e5..287a04e 100644 --- a/R/display.R +++ b/R/display.R @@ -190,7 +190,8 @@ print.summary.JD3_SARIMA_ESTIMATION <- function(x, digits = max(3L, getOption("d stde <- sqrt(diag(x$parameters$cov)) t <- estimate / stde pval <- 2 * pt(abs(t), ndf, lower.tail = FALSE) - table <- data.frame(estimate, "ESTIMATED", stde, t, pval) + table <- data.frame(estimate, "ESTIMATED", stde, t, pval, + stringsAsFactors = FALSE) colnames(table) <- c( "Estimate", "Type", "Std. Error", "T-stat", "Pr(>|t|)" @@ -398,7 +399,8 @@ print.JD3_SARIMA_ESTIMATE <- function(x, digits = max(3L, getOption("digits") - stde <- sqrt(diag(x$bvar)) t <- estimate / stde pval <- 2 * pt(abs(t), ndf, lower.tail = FALSE) - table <- data.frame(estimate, "ESTIMATED", stde, t, pval) + table <- data.frame(estimate, "ESTIMATED", stde, t, pval, + stringsAsFactors = FALSE) colnames(table) <- c( "Estimate", "Type", "Std. Error", "T-stat", "Pr(>|t|)" diff --git a/R/spec_regarima.R b/R/spec_regarima.R index fbda555..875e170 100644 --- a/R/spec_regarima.R +++ b/R/spec_regarima.R @@ -1497,7 +1497,7 @@ set_transform.default <- function(x, #' - "Seasonal": after the decomposition the effect is allocated to the seasonal component, like a Seasonal-outlier #' - "Series": after the decomposition the effect is allocated to #' the raw series: \eqn{yc_t=y_t+ effect} -#' - "Seasonally Adjusted": after the decomposition the effect is allocated to +#' - "SeasonallyAdjusted": after the decomposition the effect is allocated to #' the seasonally adjusted series: \eqn{sa_t=T+I+effect} #' @examples #' # creating one or several external regressors (TS objects), diff --git a/man/add_usrdefvar.Rd b/man/add_usrdefvar.Rd index 311c330..0500b30 100644 --- a/man/add_usrdefvar.Rd +++ b/man/add_usrdefvar.Rd @@ -54,26 +54,28 @@ for the decomposition. \item "Seasonal": after the decomposition the effect is allocated to the seasonal component, like a Seasonal-outlier \item "Series": after the decomposition the effect is allocated to the raw series: \eqn{yc_t=y_t+ effect} -\item "Seasonally Adjusted": after the decomposition the effect is allocated to +\item "SeasonallyAdjusted": after the decomposition the effect is allocated to the seasonally adjusted series: \eqn{sa_t=T+I+effect} } } \examples{ # creating one or several external regressors (TS objects), # which will be gathered in one or several groups -iv1<-intervention_variable(12, c(2000, 1), 60, -starts = "2001-01-01", ends = "2001-12-01") -iv2<- intervention_variable(12, c(2000, 1), 60, -starts = "2001-01-01", ends = "2001-12-01", delta = 1) +iv1 <- intervention_variable(12, c(2000, 1), 60, + starts = "2001-01-01", ends = "2001-12-01" +) +iv2 <- intervention_variable(12, c(2000, 1), 60, + starts = "2001-01-01", ends = "2001-12-01", delta = 1 +) # configuration 1: regressors in the same default group (named "r") -variables<-list("iv1"=iv1, "iv2"=iv2) +variables <- list("iv1" = iv1, "iv2" = iv2) # to use those regressors, input : name=r.iv1 and r.iv2 in add_usrdefvar function # configuration 2: group names are user-defined # here: regressors as a list of two groups (lists) reg1 and reg2 -vars<-list(reg1=list(iv1 = iv1),reg2=list(iv2 = iv2) ) +vars <- list(reg1 = list(iv1 = iv1), reg2 = list(iv2 = iv2)) # to use those regressors, input : name=reg1.iv1 and name=reg2.iv2 in add_usrdefvar function # creating the modelling context -my_context<-modelling_context(variables=vars) +my_context <- modelling_context(variables = vars) # customize a default specification # init_spec <- rjd3x13::x13_spec("RSA5c") # regressors have to be added one by one diff --git a/man/aggregate.Rd b/man/aggregate.Rd index 4d340db..d9ef5fb 100644 --- a/man/aggregate.Rd +++ b/man/aggregate.Rd @@ -30,7 +30,7 @@ A new time series of frequency \code{nfreq}. Makes a frequency change of this series. } \examples{ -s = ABS$X0.2.09.10.M +s <- ABS$X0.2.09.10.M # Annual sum aggregate(s, nfreq = 1, conversion = "Sum") # first and last years removed aggregate(s, nfreq = 1, conversion = "Sum", complete = FALSE) diff --git a/man/arima_difference.Rd b/man/arima_difference.Rd index adf6ad3..2bfcc56 100644 --- a/man/arima_difference.Rd +++ b/man/arima_difference.Rd @@ -20,8 +20,8 @@ a \code{"JD3_ARIMA"} model. Remove an arima model from an existing one. More exactly, m_diff = m_left - m_right iff m_left = m_right + m_diff. } \examples{ -mod1 = arima_model(delta = c(1,-2,1)) -mod2 = arima_model(variance=.01) +mod1 <- arima_model(delta = c(1, -2, 1)) +mod2 <- arima_model(variance = .01) diff <- arima_difference(mod1, mod2) sum <- arima_sum(diff, mod2) # sum should be equal to mod1 diff --git a/man/arima_model.Rd b/man/arima_model.Rd index 5b07c94..874f7e8 100644 --- a/man/arima_model.Rd +++ b/man/arima_model.Rd @@ -24,5 +24,5 @@ a \code{"JD3_ARIMA"} model. ARIMA Model } \examples{ -model <- arima_model("trend", ar=c(1,-.8), delta = c(1,-1), ma=c(1,-.5), var=100) +model <- arima_model("trend", ar = c(1, -.8), delta = c(1, -1), ma = c(1, -.5), var = 100) } diff --git a/man/arima_properties.Rd b/man/arima_properties.Rd index 9682975..f6576cb 100644 --- a/man/arima_properties.Rd +++ b/man/arima_properties.Rd @@ -20,6 +20,6 @@ A list with tha auto-covariances and with the (pseudo-)spectrum Properties of an ARIMA model; the (pseudo-)spectrum and the auto-covariances of the model are returned } \examples{ -mod1 <- arima_model(ar = c(0.1, 0.2), delta = c(1,-1), ma = 0) +mod1 <- arima_model(ar = c(0.1, 0.2), delta = c(1, -1), ma = 0) arima_properties(mod1) } diff --git a/man/arima_sum.Rd b/man/arima_sum.Rd index 4922187..31b4ac3 100644 --- a/man/arima_sum.Rd +++ b/man/arima_sum.Rd @@ -25,7 +25,7 @@ polynomials is then computed and factorized, to get the moving average polynomial and innovation variance of the sum. } \examples{ -mod1 = arima_model(ar = c(0.1, 0.2), delta = 0, ma = 0) -mod2 = arima_model(ar = 0, delta = 0, ma = c(0.4)) +mod1 <- arima_model(ar = c(0.1, 0.2), delta = 0, ma = 0) +mod2 <- arima_model(ar = 0, delta = 0, ma = c(0.4)) arima_sum(mod1, mod2) } diff --git a/man/autocorrelations.Rd b/man/autocorrelations.Rd index 345f955..7d50de2 100644 --- a/man/autocorrelations.Rd +++ b/man/autocorrelations.Rd @@ -26,7 +26,7 @@ If \code{FALSE}, we consider that the (known) mean is 0 and that the series has Autocorrelation Functions } \examples{ -x = ABS$X0.2.09.10.M +x <- ABS$X0.2.09.10.M autocorrelations(x) autocorrelations_partial(x) autocorrelations_inverse(x) diff --git a/man/calendar_td.Rd b/man/calendar_td.Rd index 9837dc8..596762d 100644 --- a/man/calendar_td.Rd +++ b/man/calendar_td.Rd @@ -55,7 +55,7 @@ Regressors are corrected for long-term mean if \code{contrasts = TRUE}. } \examples{ BE <- national_calendar(list( - fixed_day(7,21), + fixed_day(7, 21), special_day("NEWYEAR"), special_day("CHRISTMAS"), special_day("MAYDAY"), @@ -64,9 +64,12 @@ BE <- national_calendar(list( special_day("WHITMONDAY"), special_day("ASSUMPTION"), special_day("ALLSAINTSDAY"), - special_day("ARMISTICE"))) -calendar_td(BE, 12, c(1980,1), 240, holiday=7, groups=c(1,1,1,2,2,3,0), -contrasts = FALSE) + special_day("ARMISTICE") +)) +calendar_td(BE, 12, c(1980, 1), 240, + holiday = 7, groups = c(1, 1, 1, 2, 2, 3, 0), + contrasts = FALSE +) } \references{ More information on calendar correction in JDemetra+ online documentation: diff --git a/man/chained_calendar.Rd b/man/chained_calendar.Rd index 455c5d0..ff0b026 100644 --- a/man/chained_calendar.Rd +++ b/man/chained_calendar.Rd @@ -23,9 +23,9 @@ In such a case two calendars describing the situation before and after the chang and bound together, one before the break and one after the break. } \examples{ -Belgium <- national_calendar(list(special_day("NEWYEAR"),fixed_day(7,21))) -France <- national_calendar(list(special_day("NEWYEAR"),fixed_day(7,14))) -chained_cal<-chained_calendar(France, Belgium, "2000-01-01") +Belgium <- national_calendar(list(special_day("NEWYEAR"), fixed_day(7, 21))) +France <- national_calendar(list(special_day("NEWYEAR"), fixed_day(7, 14))) +chained_cal <- chained_calendar(France, Belgium, "2000-01-01") } \references{ diff --git a/man/data_to_ts.Rd b/man/data_to_ts.Rd index 1fb6a60..25c52fe 100644 --- a/man/data_to_ts.Rd +++ b/man/data_to_ts.Rd @@ -15,6 +15,6 @@ data_to_ts(s, name) Promote a R time series to a "full" \code{ts} of JDemetra+ } \examples{ -s<-ABS$X0.2.09.10.M -t<-data_to_ts(s,"test") +s <- ABS$X0.2.09.10.M +t <- data_to_ts(s, "test") } diff --git a/man/differences.Rd b/man/differences.Rd index 70d5f4c..7da8221 100644 --- a/man/differences.Rd +++ b/man/differences.Rd @@ -20,6 +20,6 @@ The differenced series. Differencing of a series } \examples{ -differences(retail$BookStores, c(1,1,12), FALSE) +differences(retail$BookStores, c(1, 1, 12), FALSE) } diff --git a/man/differencing_fast.Rd b/man/differencing_fast.Rd index d977c5b..195013e 100644 --- a/man/differencing_fast.Rd +++ b/man/differencing_fast.Rd @@ -33,6 +33,6 @@ Stationary transformation The series is differenced till its variance is decreasing. } \examples{ -differencing_fast(log(ABS$X0.2.09.10.M),12) +differencing_fast(log(ABS$X0.2.09.10.M), 12) } diff --git a/man/do_stationary.Rd b/man/do_stationary.Rd index 7a0170d..b4ae123 100644 --- a/man/do_stationary.Rd +++ b/man/do_stationary.Rd @@ -29,5 +29,5 @@ The series should not be seasonal. Source: Tramo } \examples{ -do_stationary(log(ABS$X0.2.09.10.M),12) +do_stationary(log(ABS$X0.2.09.10.M), 12) } diff --git a/man/easter_dates.Rd b/man/easter_dates.Rd index d07629c..fd400d0 100644 --- a/man/easter_dates.Rd +++ b/man/easter_dates.Rd @@ -20,7 +20,7 @@ Allows to display the date of Easter Sunday for each year, in the defined period displayed in "YYYY-MM-DD" format and as a number of days since January 1st 1970. } \examples{ -#Dates from 2018(included) to 2023 (included) +# Dates from 2018(included) to 2023 (included) easter_dates(2018, 2023) } \references{ diff --git a/man/easter_day.Rd b/man/easter_day.Rd index a14c799..f5f1d04 100644 --- a/man/easter_day.Rd +++ b/man/easter_day.Rd @@ -19,12 +19,14 @@ easter_day(offset, julian = FALSE, weight = 1, validity = NULL) Allows to define a holiday which date is related to Easter Sunday. } \examples{ -easter_day(1) #Easter Monday +easter_day(1) # Easter Monday easter_day(-2) # Easter Good Friday # Corpus Christi 60 days after Easter # Sunday in Julian calendar with weight 0.5, from January 2000 to December 2020 -easter_day(offset=60,julian=TRUE,weight=0.5, -validity = list(start="2000-01-01", end = "2020-12-01")) +easter_day( + offset = 60, julian = TRUE, weight = 0.5, + validity = list(start = "2000-01-01", end = "2020-12-01") +) } \references{ More information on calendar correction in JDemetra+ online documentation: diff --git a/man/easter_variable.Rd b/man/easter_variable.Rd index e4456d2..ac9154f 100644 --- a/man/easter_variable.Rd +++ b/man/easter_variable.Rd @@ -40,8 +40,8 @@ A time series (object of class \code{"ts"}) Allows to generate a regressor taking into account the (Julian) Easter effect in monthly or quarterly time series. } \examples{ -#Monthly regressor, five-year long, duration 8 days, effect finishing on Easter Monday -ee<-easter_variable(12, c(2020,1),length=5*12,duration=8, endpos=1) +# Monthly regressor, five-year long, duration 8 days, effect finishing on Easter Monday +ee <- easter_variable(12, c(2020, 1), length = 5 * 12, duration = 8, endpos = 1) } \references{ More information on calendar correction in JDemetra+ online documentation: diff --git a/man/fixed_day.Rd b/man/fixed_day.Rd index 86d5a66..c6f02f7 100644 --- a/man/fixed_day.Rd +++ b/man/fixed_day.Rd @@ -22,10 +22,10 @@ like Christmas which is always celebrated on December 25th. } \examples{ day <- fixed_day(7, 21, .9) -day # July 21st, with weight=0.9, on the whole sample +day # July 21st, with weight=0.9, on the whole sample day <- fixed_day(12, 25, .5, validity = list(start = "2010-01-01")) day # December 25th, with weight=0.5, from January 2010 -day <- fixed_day(12, 25, .5, validity = list(start="1968-02-01", end = "2010-01-01")) +day <- fixed_day(12, 25, .5, validity = list(start = "1968-02-01", end = "2010-01-01")) day # December 25th, with weight=0.9, from February 1968 until January 2010 } \references{ diff --git a/man/holidays.Rd b/man/holidays.Rd index f6abede..4c55014 100644 --- a/man/holidays.Rd +++ b/man/holidays.Rd @@ -44,18 +44,19 @@ This kind of non-aggregated regressors are used for calendar correction in daily } \examples{ BE <- national_calendar(list( - fixed_day(7,21), - special_day("NEWYEAR"), - special_day("CHRISTMAS"), - special_day("MAYDAY"), - special_day("EASTERMONDAY"), - special_day("ASCENSION"), - special_day("WHITMONDAY"), - special_day("ASSUMPTION"), - special_day("ALLSAINTSDAY"), - special_day("ARMISTICE"))) -q<-holidays(BE, "2021-01-01", 366*10, type="All") -plot(apply(q,1, max)) + fixed_day(7, 21), + special_day("NEWYEAR"), + special_day("CHRISTMAS"), + special_day("MAYDAY"), + special_day("EASTERMONDAY"), + special_day("ASCENSION"), + special_day("WHITMONDAY"), + special_day("ASSUMPTION"), + special_day("ALLSAINTSDAY"), + special_day("ARMISTICE") +)) +q <- holidays(BE, "2021-01-01", 366 * 10, type = "All") +plot(apply(q, 1, max)) } \references{ More information on calendar correction in JDemetra+ online documentation: diff --git a/man/intervention_variable.Rd b/man/intervention_variable.Rd index 78ef25a..7356182 100644 --- a/man/intervention_variable.Rd +++ b/man/intervention_variable.Rd @@ -48,17 +48,19 @@ by the parameters \code{starts} and \code{ends}. With \code{delta = 1} and \code the cumulative sum of temporary level shifts, once differenced the regressor will become a classical level shift. } \examples{ -iv1<-intervention_variable(12, c(2000, 1), 60, - starts = "2001-01-01", ends = "2001-12-01") +iv1 <- intervention_variable(12, c(2000, 1), 60, + starts = "2001-01-01", ends = "2001-12-01" +) plot(iv1) -iv2<- intervention_variable(12, c(2000, 1), 60, - starts = "2001-01-01", ends = "2001-12-01", delta = 1) -plot (iv2) +iv2 <- intervention_variable(12, c(2000, 1), 60, + starts = "2001-01-01", ends = "2001-12-01", delta = 1 +) +plot(iv2) # using one variable in a a seasonal adjustment process # regressors as a list of two groups reg1 and reg2 -vars<-list(reg1=list(x = iv1),reg2=list(x = iv2) ) +vars <- list(reg1 = list(x = iv1), reg2 = list(x = iv2)) # creating the modelling context -my_context<-modelling_context(variables=vars) +my_context <- modelling_context(variables = vars) # customize a default specification # init_spec <- rjd3x13::x13_spec("RSA5c") # new_spec<- add_usrdefvar(init_spec,id = "reg1.iv1", regeffect="Trend") diff --git a/man/ljungbox.Rd b/man/ljungbox.Rd index 8ceda81..4bae32c 100644 --- a/man/ljungbox.Rd +++ b/man/ljungbox.Rd @@ -29,6 +29,6 @@ A \code{c("JD3_TEST", "JD3")} object (see \code{\link[=statisticaltest]{statisti Compute Ljung-Box test to check the independence of a data. } \examples{ -ljungbox(random_t(2, 100), lag = 24, k =1) -ljungbox(ABS$X0.2.09.10.M, lag = 24, k =1) +ljungbox(random_t(2, 100), lag = 24, k = 1) +ljungbox(ABS$X0.2.09.10.M, lag = 24, k = 1) } diff --git a/man/long_term_mean.Rd b/man/long_term_mean.Rd index 04f5034..c263b27 100644 --- a/man/long_term_mean.Rd +++ b/man/long_term_mean.Rd @@ -39,17 +39,19 @@ A long-term mean is a probability based computation of the average value for eve } \examples{ BE <- national_calendar(list( -fixed_day(7,21), -special_day("NEWYEAR"), -special_day("CHRISTMAS"), -special_day("MAYDAY"), -special_day("EASTERMONDAY"), -special_day("ASCENSION"), -special_day("WHITMONDAY"), -special_day("ASSUMPTION"), -special_day("ALLSAINTSDAY"), -special_day("ARMISTICE"))) -lt<-long_term_mean(BE,12, - groups = c(1,1,1,1,1,0,0), - holiday = 7) + fixed_day(7, 21), + special_day("NEWYEAR"), + special_day("CHRISTMAS"), + special_day("MAYDAY"), + special_day("EASTERMONDAY"), + special_day("ASCENSION"), + special_day("WHITMONDAY"), + special_day("ASSUMPTION"), + special_day("ALLSAINTSDAY"), + special_day("ARMISTICE") +)) +lt <- long_term_mean(BE, 12, + groups = c(1, 1, 1, 1, 1, 0, 0), + holiday = 7 +) } diff --git a/man/lp_variable.Rd b/man/lp_variable.Rd index 7fccf57..7646b59 100644 --- a/man/lp_variable.Rd +++ b/man/lp_variable.Rd @@ -32,8 +32,8 @@ Allows to generate a regressor correcting for the leap year or length-of-period } \examples{ # Leap years occur in year 2000, 2004, 2008 and 2012 -lp_variable(4, start = c(2000, 1), length = 4*13) -lper<-lp_variable(12,c(2000,1),length=10*12,type ="LengthOfPeriod") +lp_variable(4, start = c(2000, 1), length = 4 * 13) +lper <- lp_variable(12, c(2000, 1), length = 10 * 12, type = "LengthOfPeriod") } \references{ More information on calendar correction in JDemetra+ online documentation: diff --git a/man/mad.Rd b/man/mad.Rd index 7fef9fe..ec1d66e 100644 --- a/man/mad.Rd +++ b/man/mad.Rd @@ -20,6 +20,6 @@ The median absolute deviation Compute a robust median absolute deviation (MAD) } \examples{ -y<-rnorm(1000) -m<-rjd3toolkit::mad(y, centile=70) +y <- rnorm(1000) +m <- rjd3toolkit::mad(y, centile = 70) } diff --git a/man/modelling_context.Rd b/man/modelling_context.Rd index b00e486..48ac647 100644 --- a/man/modelling_context.Rd +++ b/man/modelling_context.Rd @@ -22,14 +22,16 @@ or come from any other source, provided they are \code{ts} class objects. \examples{ # creating one or several external regressors (TS objects), which will # be gathered in one or several groups -iv1<-intervention_variable(12, c(2000, 1), 60, -starts = "2001-01-01", ends = "2001-12-01") -iv2<- intervention_variable(12, c(2000, 1), 60, -starts = "2001-01-01", ends = "2001-12-01", delta = 1) +iv1 <- intervention_variable(12, c(2000, 1), 60, + starts = "2001-01-01", ends = "2001-12-01" +) +iv2 <- intervention_variable(12, c(2000, 1), 60, + starts = "2001-01-01", ends = "2001-12-01", delta = 1 +) # regressors as a list of two groups reg1 and reg2 -vars<-list(reg1=list(x = iv1),reg2=list(x = iv2) ) +vars <- list(reg1 = list(x = iv1), reg2 = list(x = iv2)) # creating the modelling context -my_context<-modelling_context(variables=vars) +my_context <- modelling_context(variables = vars) # customize a default specification # init_spec <- rjd3x13::x13_spec("RSA5c") # new_spec<- add_usrdefvar(init_spec,name = "reg1.iv1", regeffect="Trend") diff --git a/man/national_calendar.Rd b/man/national_calendar.Rd index a26faa0..445e676 100644 --- a/man/national_calendar.Rd +++ b/man/national_calendar.Rd @@ -21,23 +21,26 @@ The holidays have to be generated by one of these functions: \code{fixed_day()}, \code{fixed_week_day()}, \code{easter_day()}, \code{special_day()} or \code{single_day()}. } \examples{ -#Fictional calendar using all possibilities to set the required holidays +# Fictional calendar using all possibilities to set the required holidays MyCalendar <- national_calendar(list( - fixed_day(7,21), - special_day("NEWYEAR"), - special_day("CHRISTMAS"), - fixed_week_day(7, 2, 3), # second Wednesday of July - special_day("MAYDAY"), - easter_day(1), # Easter Monday - easter_day(-2), # Good Friday - single_day("2001-09-11"), # appearing once - special_day("ASCENSION"), - easter_day(offset=60, julian=FALSE, weight=0.5, - validity = list(start="2000-01-01", end = "2020-12-01")), # Corpus Christi - special_day("WHITMONDAY"), - special_day("ASSUMPTION"), - special_day("ALLSAINTSDAY"), - special_day("ARMISTICE"))) + fixed_day(7, 21), + special_day("NEWYEAR"), + special_day("CHRISTMAS"), + fixed_week_day(7, 2, 3), # second Wednesday of July + special_day("MAYDAY"), + easter_day(1), # Easter Monday + easter_day(-2), # Good Friday + single_day("2001-09-11"), # appearing once + special_day("ASCENSION"), + easter_day( + offset = 60, julian = FALSE, weight = 0.5, + validity = list(start = "2000-01-01", end = "2020-12-01") + ), # Corpus Christi + special_day("WHITMONDAY"), + special_day("ASSUMPTION"), + special_day("ALLSAINTSDAY"), + special_day("ARMISTICE") +)) } \references{ More information on calendar correction in JDemetra+ online documentation: diff --git a/man/normality_tests.Rd b/man/normality_tests.Rd index d97ce53..13b1f5d 100644 --- a/man/normality_tests.Rd +++ b/man/normality_tests.Rd @@ -46,7 +46,7 @@ Set of functions to test the normality of a time series. }} \examples{ -x <- rnorm(100) # null +x <- rnorm(100) # null bowmanshenton(x) doornikhansen(x) jarquebera(x) diff --git a/man/outliers_variables.Rd b/man/outliers_variables.Rd index 5b984ea..6f14f97 100644 --- a/man/outliers_variables.Rd +++ b/man/outliers_variables.Rd @@ -52,11 +52,13 @@ A seasonal outlier (SO, \code{so_variable}) is defined as (if \code{zeroended = -\frac{1}{s-1} & \text{otherwise }\end{cases}} } \examples{ -#Outliers in February 2002 -ao <- ao_variable(12, c(2000,1), length = 12*4, date = "2002-02-01") -ls <- ls_variable(12, c(2000,1), length = 12*4, date = "2002-02-01") -tc <- tc_variable(12, c(2000,1), length = 12*4, date = "2002-02-01") -so <- so_variable(12, c(2000,1), length = 12*4, date = "2002-02-01") -plot.ts(ts.union(ao, ls, tc, so), plot.type = "single", - col = c("black", "orange", "green", "gray")) +# Outliers in February 2002 +ao <- ao_variable(12, c(2000, 1), length = 12 * 4, date = "2002-02-01") +ls <- ls_variable(12, c(2000, 1), length = 12 * 4, date = "2002-02-01") +tc <- tc_variable(12, c(2000, 1), length = 12 * 4, date = "2002-02-01") +so <- so_variable(12, c(2000, 1), length = 12 * 4, date = "2002-02-01") +plot.ts(ts.union(ao, ls, tc, so), + plot.type = "single", + col = c("black", "orange", "green", "gray") +) } diff --git a/man/periodic.dummies.Rd b/man/periodic.dummies.Rd index c5e5573..f91e5a7 100644 --- a/man/periodic.dummies.Rd +++ b/man/periodic.dummies.Rd @@ -28,8 +28,8 @@ The periodic.contrasts function is based on periodic.dummies but adds -1 to the } \examples{ # periodic dummies for a quarterly series -p<-periodic.dummies(4, c(2000,1), 60) -#periodic contrasts for a quarterly series -q<-periodic.contrasts(4, c(2000,1), 60) -q[1:9,] +p <- periodic.dummies(4, c(2000, 1), 60) +# periodic contrasts for a quarterly series +q <- periodic.contrasts(4, c(2000, 1), 60) +q[1:9, ] } diff --git a/man/r2jd_calendarts.Rd b/man/r2jd_calendarts.Rd index 86c203c..255b717 100644 --- a/man/r2jd_calendarts.Rd +++ b/man/r2jd_calendarts.Rd @@ -13,9 +13,9 @@ r2jd_calendarts(calendarobs) Create Java CalendarTimeSeries } \examples{ -obs<-list( -list(start=as.Date("1980-01-01"), end=as.Date("1999-12-31"), value=2000), -list(start=as.Date("2000-01-01"), end=as.Date("2010-01-01"), value=1000) +obs <- list( + list(start = as.Date("1980-01-01"), end = as.Date("1999-12-31"), value = 2000), + list(start = as.Date("2000-01-01"), end = as.Date("2010-01-01"), value = 1000) ) -jobj<-r2jd_calendarts(obs) +jobj <- r2jd_calendarts(obs) } diff --git a/man/ramp_variable.Rd b/man/ramp_variable.Rd index df7545b..e1062a4 100644 --- a/man/ramp_variable.Rd +++ b/man/ramp_variable.Rd @@ -33,8 +33,8 @@ A ramp between two dates \eqn{t_0} and \eqn{t_1} is defined as: } \examples{ # Ramp variable from January 2001 to September 2001 -rp <- ramp_variable(12, c(2000,1), length = 12*4, range = c(13, 21)) +rp <- ramp_variable(12, c(2000, 1), length = 12 * 4, range = c(13, 21)) # Or equivalently -rp<-ramp_variable(12, c(2000,1), length = 12*4, range = c("2001-01-01", "2001-09-02")) +rp <- ramp_variable(12, c(2000, 1), length = 12 * 4, range = c("2001-01-01", "2001-09-02")) plot.ts(rp) } diff --git a/man/rangemean_tstat.Rd b/man/rangemean_tstat.Rd index 3dc8df0..7abc9dc 100644 --- a/man/rangemean_tstat.Rd +++ b/man/rangemean_tstat.Rd @@ -49,19 +49,19 @@ The function \code{rangemean_tstat} returns the T-statistic associated to \eqn{\ If it is significantly higher than 0, log transformation is recommended. } \examples{ -y = ABS$X0.2.09.10.M +y <- ABS$X0.2.09.10.M # Multiplicative pattern plot(y) -period = 12 -rm_t = rangemean_tstat(y, period = period, groupsize = period) +period <- 12 +rm_t <- rangemean_tstat(y, period = period, groupsize = period) rm_t # higher than 0 # Can be tested: pt(rm_t, period - 2, lower.tail = FALSE) # Or : -1-cdf_t(period-2, rm_t) +1 - cdf_t(period - 2, rm_t) # Close to 0 -rm_t_log = rangemean_tstat(log(y), period = period, groupsize = period) +rm_t_log <- rangemean_tstat(log(y), period = period, groupsize = period) rm_t_log pt(rm_t_log, period - 2, lower.tail = FALSE) } diff --git a/man/sarima_decompose.Rd b/man/sarima_decompose.Rd index 7491a3a..a669768 100644 --- a/man/sarima_decompose.Rd +++ b/man/sarima_decompose.Rd @@ -20,7 +20,7 @@ An UCARIMA model Decompose SARIMA Model into three components trend, seasonal, irregular } \examples{ -model <- sarima_model(period = 12, d =1, bd = 1, theta = -0.6, btheta = -0.5) +model <- sarima_model(period = 12, d = 1, bd = 1, theta = -0.6, btheta = -0.5) ucm <- sarima_decompose(model) } diff --git a/man/sarima_estimate.Rd b/man/sarima_estimate.Rd index 818726d..4703ca9 100644 --- a/man/sarima_estimate.Rd +++ b/man/sarima_estimate.Rd @@ -32,5 +32,5 @@ Estimate SARIMA Model } \examples{ y <- ABS$X0.2.09.10.M -sarima_estimate(y, order = c(0,1,1), seasonal = c(0,1,1)) +sarima_estimate(y, order = c(0, 1, 1), seasonal = c(0, 1, 1)) } diff --git a/man/sarima_hannan_rissanen.Rd b/man/sarima_hannan_rissanen.Rd index d0faa56..2c247b7 100644 --- a/man/sarima_hannan_rissanen.Rd +++ b/man/sarima_hannan_rissanen.Rd @@ -32,5 +32,5 @@ Title } \examples{ y <- ABS$X0.2.09.10.M -sarima_hannan_rissanen(y, order = c(0,1,1), seasonal = c(0,1,1)) +sarima_hannan_rissanen(y, order = c(0, 1, 1), seasonal = c(0, 1, 1)) } diff --git a/man/sarima_random.Rd b/man/sarima_random.Rd index 2111169..59b9e31 100644 --- a/man/sarima_random.Rd +++ b/man/sarima_random.Rd @@ -24,7 +24,7 @@ Simulate Seasonal ARIMA } \examples{ # Airline model -s_model <- sarima_model(period = 12, d =1, bd = 1, theta = 0.2, btheta = 0.2) +s_model <- sarima_model(period = 12, d = 1, bd = 1, theta = 0.2, btheta = 0.2) x <- sarima_random(s_model, length = 64, seed = 0) plot(x, type = "l") } diff --git a/man/seasonality_canovahansen.Rd b/man/seasonality_canovahansen.Rd index ccb43b0..1d82344 100644 --- a/man/seasonality_canovahansen.Rd +++ b/man/seasonality_canovahansen.Rd @@ -36,7 +36,7 @@ list with the FTest on seasonal variables, the joint test and the details for th Canova-Hansen seasonality test } \examples{ -s<-log(ABS$X0.2.20.10.M) -seasonality_canovahansen(s, 12, type="Contrast") -seasonality_canovahansen(s, 12, type="Trigonometric") +s <- log(ABS$X0.2.20.10.M) +seasonality_canovahansen(s, 12, type = "Contrast") +seasonality_canovahansen(s, 12, type = "Trigonometric") } diff --git a/man/seasonality_canovahansen_trigs.Rd b/man/seasonality_canovahansen_trigs.Rd index 5e82404..f6644c8 100644 --- a/man/seasonality_canovahansen_trigs.Rd +++ b/man/seasonality_canovahansen_trigs.Rd @@ -30,7 +30,7 @@ seasonality_canovahansen_trigs( Canova-Hansen test using trigonometric variables } \examples{ -s<-log(ABS$X0.2.20.10.M) -freqs<-seq(0.01, 0.5, 0.001) -plot(seasonality_canovahansen_trigs(s, 1/freqs, original = FALSE), type='l') +s <- log(ABS$X0.2.20.10.M) +freqs <- seq(0.01, 0.5, 0.001) +plot(seasonality_canovahansen_trigs(s, 1 / freqs, original = FALSE), type = "l") } diff --git a/man/seasonality_combined.Rd b/man/seasonality_combined.Rd index 6d63b53..33e6142 100644 --- a/man/seasonality_combined.Rd +++ b/man/seasonality_combined.Rd @@ -29,7 +29,7 @@ If \code{data} is not a \code{"ts"} object, \code{firstperiod = 1} by default.} Combined test on the presence of identifiable seasonality (see Ladiray and Quenneville, 1999). } \examples{ -s<-do_stationary(log(ABS$X0.2.09.10.M))$ddata +s <- do_stationary(log(ABS$X0.2.09.10.M))$ddata seasonality_combined(s) seasonality_combined(random_t(2, 1000), 7) } diff --git a/man/seasonality_f.Rd b/man/seasonality_f.Rd index eb5dec3..ac25531 100644 --- a/man/seasonality_f.Rd +++ b/man/seasonality_f.Rd @@ -27,6 +27,6 @@ F-test on seasonal dummies Estimation of a model with seasonal dummies. Joint F-test on the coefficients of the dummies. } \examples{ -seasonality_f(ABS$X0.2.09.10.M, model="D1") +seasonality_f(ABS$X0.2.09.10.M, model = "D1") seasonality_f(random_t(2, 1000), 7) } diff --git a/man/seasonality_friedman.Rd b/man/seasonality_friedman.Rd index 107e051..f5cb399 100644 --- a/man/seasonality_friedman.Rd +++ b/man/seasonality_friedman.Rd @@ -25,7 +25,7 @@ Friedman Seasonality Test Non parametric test ("ANOVA"-type). } \examples{ -s<-do_stationary(log(ABS$X0.2.09.10.M))$ddata +s <- do_stationary(log(ABS$X0.2.09.10.M))$ddata seasonality_friedman(s) seasonality_friedman(random_t(2, 1000), 12) } diff --git a/man/seasonality_kruskalwallis.Rd b/man/seasonality_kruskalwallis.Rd index fce4dbd..c8090e9 100644 --- a/man/seasonality_kruskalwallis.Rd +++ b/man/seasonality_kruskalwallis.Rd @@ -25,7 +25,7 @@ Kruskall-Wallis Seasonality Test Non parametric test on the ranks. } \examples{ -s<-do_stationary(log(ABS$X0.2.09.10.M))$ddata +s <- do_stationary(log(ABS$X0.2.09.10.M))$ddata seasonality_kruskalwallis(s) seasonality_kruskalwallis(random_t(2, 1000), 7) } diff --git a/man/seasonality_modified_qs.Rd b/man/seasonality_modified_qs.Rd index 8a3ef0e..1bd7b35 100644 --- a/man/seasonality_modified_qs.Rd +++ b/man/seasonality_modified_qs.Rd @@ -28,6 +28,6 @@ Remark: the length of the series has some impact on the p-values, mainly on short series. Not critical. } \examples{ -s<-do_stationary(log(ABS$X0.2.09.10.M))$ddata +s <- do_stationary(log(ABS$X0.2.09.10.M))$ddata seasonality_modified_qs(s) } diff --git a/man/seasonality_periodogram.Rd b/man/seasonality_periodogram.Rd index 87462ca..1b6038b 100644 --- a/man/seasonality_periodogram.Rd +++ b/man/seasonality_periodogram.Rd @@ -25,7 +25,7 @@ Periodogram Seasonality Test Tests on the sum of a periodogram at seasonal frequencies. } \examples{ -s<-do_stationary(log(ABS$X0.2.09.10.M))$ddata +s <- do_stationary(log(ABS$X0.2.09.10.M))$ddata seasonality_periodogram(s) seasonality_periodogram(random_t(2, 1000), 7) } diff --git a/man/seasonality_qs.Rd b/man/seasonality_qs.Rd index b915e10..40a17e8 100644 --- a/man/seasonality_qs.Rd +++ b/man/seasonality_qs.Rd @@ -25,7 +25,7 @@ A \code{c("JD3_TEST", "JD3")} object (see \code{\link[=statisticaltest]{statisti QS (seasonal Ljung-Box) test. } \examples{ -s<-do_stationary(log(ABS$X0.2.09.10.M))$ddata +s <- do_stationary(log(ABS$X0.2.09.10.M))$ddata seasonality_qs(s) seasonality_qs(random_t(2, 1000), 7) } diff --git a/man/set_tradingdays.Rd b/man/set_tradingdays.Rd index 02ab1eb..f6cd233 100644 --- a/man/set_tradingdays.Rd +++ b/man/set_tradingdays.Rd @@ -117,20 +117,21 @@ generated with \code{rjd3tramoseats::spec_tramoseats()} or "JD3_TRAMO_SPEC" gene # Pre-defined regressors based on user-defined calendar ### create a calendar BE <- national_calendar(list( -fixed_day(7,21), - special_day("NEWYEAR"), - special_day("CHRISTMAS"), - special_day("MAYDAY"), - special_day("EASTERMONDAY"), - special_day("ASCENSION"), - special_day("WHITMONDAY"), - special_day("ASSUMPTION"), - special_day("ALLSAINTSDAY"), - special_day("ARMISTICE"))) + fixed_day(7, 21), + special_day("NEWYEAR"), + special_day("CHRISTMAS"), + special_day("MAYDAY"), + special_day("EASTERMONDAY"), + special_day("ASCENSION"), + special_day("WHITMONDAY"), + special_day("ASSUMPTION"), + special_day("ALLSAINTSDAY"), + special_day("ARMISTICE") +)) ## put into a context -my_context<-modelling_context(calendars = list(cal=BE)) +my_context <- modelling_context(calendars = list(cal = BE)) ## create a specification -#init_spec <- rjd3x13::x13_spec("RSA5c") +# init_spec <- rjd3x13::x13_spec("RSA5c") ## modify the specification # new_spec<-set_tradingdays(init_spec, # option = "TradingDays", calendar.name="cal") diff --git a/man/special_day.Rd b/man/special_day.Rd index f2601b2..73ae50c 100644 --- a/man/special_day.Rd +++ b/man/special_day.Rd @@ -49,8 +49,10 @@ CHRISTMAS \tab Fixed holiday, falls on December, 25th. # To add Easter Monday special_day("EASTERMONDAY") # To define a holiday for the day after Christmas, with validity and weight -special_day("CHRISTMAS", offset = 1, weight = 0.8, -validity = list(start="2000-01-01", end = "2020-12-01")) +special_day("CHRISTMAS", + offset = 1, weight = 0.8, + validity = list(start = "2000-01-01", end = "2020-12-01") +) } \references{ More information on calendar correction in JDemetra+ online documentation: diff --git a/man/statisticaltest.Rd b/man/statisticaltest.Rd index f94f642..0eedf9e 100644 --- a/man/statisticaltest.Rd +++ b/man/statisticaltest.Rd @@ -30,7 +30,7 @@ statisticaltest(val, pval, dist = NULL) Generic function to format the results of 'JDemetra+' tests. } \examples{ -udr_test = testofupdownruns(random_t(5, 1000)) +udr_test <- testofupdownruns(random_t(5, 1000)) udr_test # default print print(udr_test, details = TRUE) # with the distribution diff --git a/man/td.Rd b/man/td.Rd index a93e9d4..c6cf2f5 100644 --- a/man/td.Rd +++ b/man/td.Rd @@ -46,10 +46,10 @@ the reference group (0). \examples{ # Monthly regressors for Trading Days: each type of day is different # contrasts to Sundays (6 series) -regs_td<- td(12,c(2020,1),60, groups = c(1, 2, 3, 4, 5, 6, 0), contrasts = TRUE) +regs_td <- td(12, c(2020, 1), 60, groups = c(1, 2, 3, 4, 5, 6, 0), contrasts = TRUE) # Quarterly regressors for Working Days: week days are similar # contrasts to week-end days (1 series) -regs_wd<- td(4,c(2020,1),60, groups = c(1, 1, 1, 1, 1, 0, 0), contrasts = TRUE) +regs_wd <- td(4, c(2020, 1), 60, groups = c(1, 1, 1, 1, 1, 0, 0), contrasts = TRUE) } \references{ More information on calendar correction in JDemetra+ online documentation: diff --git a/man/td_canovahansen.Rd b/man/td_canovahansen.Rd index b210cec..7dff89b 100644 --- a/man/td_canovahansen.Rd +++ b/man/td_canovahansen.Rd @@ -27,6 +27,6 @@ list with the ftest on td, the joint test and the details for the stability of t Canova-Hansen test for stable trading days } \examples{ -s<-log(ABS$X0.2.20.10.M) -td_canovahansen(s, c(1,12)) +s <- log(ABS$X0.2.20.10.M) +td_canovahansen(s, c(1, 12)) } diff --git a/man/td_timevarying.Rd b/man/td_timevarying.Rd index 509e83b..99451fd 100644 --- a/man/td_timevarying.Rd +++ b/man/td_timevarying.Rd @@ -22,6 +22,6 @@ A Chi2 test Likelihood ratio test on time varying trading days } \examples{ -s<-log(ABS$X0.2.20.10.M) +s <- log(ABS$X0.2.20.10.M) td_timevarying(s) } diff --git a/man/tsdata_of.Rd b/man/tsdata_of.Rd index 6d1a462..e83425f 100644 --- a/man/tsdata_of.Rd +++ b/man/tsdata_of.Rd @@ -21,7 +21,7 @@ Title } \examples{ # Annual series -s<-tsdata_of(c(1,2,3,4), c("1990-01-01", "1995-01-01", "1996-01-01", "2000-11-01")) +s <- tsdata_of(c(1, 2, 3, 4), c("1990-01-01", "1995-01-01", "1996-01-01", "2000-11-01")) # Quarterly series -t<-tsdata_of(c(1,2,3,NA,4), c("1990-01-01", "1995-01-01", "1996-01-01", "2000-08-01", "2000-11-01")) +t <- tsdata_of(c(1, 2, 3, NA, 4), c("1990-01-01", "1995-01-01", "1996-01-01", "2000-08-01", "2000-11-01")) } diff --git a/man/ucarima_canonical.Rd b/man/ucarima_canonical.Rd index ddc6b74..7b2cbd4 100644 --- a/man/ucarima_canonical.Rd +++ b/man/ucarima_canonical.Rd @@ -20,8 +20,8 @@ A new UCARIMA model Makes a UCARIMA model canonical; more specifically, put all the noise of the components in one dedicated component } \examples{ -mod1 <- arima_model("trend", delta = c(1,-2,1)) +mod1 <- arima_model("trend", delta = c(1, -2, 1)) mod2 <- arima_model("noise", var = 1600) -hp <- ucarima_model(components=list(mod1, mod2)) -hpc <- ucarima_canonical(hp, cmp=2) +hp <- ucarima_model(components = list(mod1, mod2)) +hpc <- ucarima_canonical(hp, cmp = 2) } diff --git a/man/ucarima_estimate.Rd b/man/ucarima_estimate.Rd index 7e998c9..3bd3680 100644 --- a/man/ucarima_estimate.Rd +++ b/man/ucarima_estimate.Rd @@ -20,12 +20,12 @@ A matrix containing the different components and their standard deviations if st Estimate UCARIMA Model } \examples{ -mod1 <- arima_model("trend", delta = c(1,-2,1)) +mod1 <- arima_model("trend", delta = c(1, -2, 1)) mod2 <- arima_model("noise", var = 16) -hp <- ucarima_model(components=list(mod1, mod2)) +hp <- ucarima_model(components = list(mod1, mod2)) s <- log(aggregate(retail$AutomobileDealers)) -all <- ucarima_estimate(s, hp, stdev=TRUE) -plot(s, type = 'l') -t <- ts(all[,1], frequency = frequency(s), start = start(s)) -lines(t, col='blue') +all <- ucarima_estimate(s, hp, stdev = TRUE) +plot(s, type = "l") +t <- ts(all[, 1], frequency = frequency(s), start = start(s)) +lines(t, col = "blue") } diff --git a/man/ucarima_model.Rd b/man/ucarima_model.Rd index c7f7ae2..3bc363b 100644 --- a/man/ucarima_model.Rd +++ b/man/ucarima_model.Rd @@ -26,8 +26,8 @@ Creates an UCARIMA model, which is composed of ARIMA models with independent innovations. } \examples{ -mod1 <- arima_model("trend", delta = c(1,-2,1)) +mod1 <- arima_model("trend", delta = c(1, -2, 1)) mod2 <- arima_model("noise", var = 1600) -hp<-ucarima_model(components=list(mod1, mod2)) +hp <- ucarima_model(components = list(mod1, mod2)) print(hp$model) } diff --git a/man/ucarima_wk.Rd b/man/ucarima_wk.Rd index 54616b1..0559c8b 100644 --- a/man/ucarima_wk.Rd +++ b/man/ucarima_wk.Rd @@ -24,10 +24,10 @@ A list with the (pseudo-)spectrum, the weights of the filter and the squared-gai Wiener Kolmogorov Estimators } \examples{ -mod1 <- arima_model("trend", delta = c(1,-2,1)) +mod1 <- arima_model("trend", delta = c(1, -2, 1)) mod2 <- arima_model("noise", var = 1600) -hp<-ucarima_model(components=list(mod1, mod2)) -wk1<-ucarima_wk(hp, 1, nwk=50) -wk2<-ucarima_wk(hp, 2) -plot(wk1$filter, type='h') +hp <- ucarima_model(components = list(mod1, mod2)) +wk1 <- ucarima_wk(hp, 1, nwk = 50) +wk2 <- ucarima_wk(hp, 2) +plot(wk1$filter, type = "h") } diff --git a/man/weighted_calendar.Rd b/man/weighted_calendar.Rd index 0962693..79b45af 100644 --- a/man/weighted_calendar.Rd +++ b/man/weighted_calendar.Rd @@ -25,9 +25,9 @@ For example, in Germany public holidays are determined by the federal states. Therefore, Epiphany is celebrated only in Baden-Wurttemberg, Bavaria and in Saxony-Anhalt, while from 1994 Day of Repentance and Prayer is celebrated only in Saxony. } \examples{ -Belgium <- national_calendar(list(special_day("NEWYEAR"),fixed_day(7,21))) -France <- national_calendar(list(special_day("NEWYEAR"),fixed_day(7,14))) -composite_calendar<- weighted_calendar(list(France,Belgium), weights = c(1,2)) +Belgium <- national_calendar(list(special_day("NEWYEAR"), fixed_day(7, 21))) +France <- national_calendar(list(special_day("NEWYEAR"), fixed_day(7, 14))) +composite_calendar <- weighted_calendar(list(France, Belgium), weights = c(1, 2)) } \references{ More information on calendar correction in JDemetra+ online documentation: