select_bwidth {deseats}R Documentation

Optimal Bandwidth Estimation for Locally Weighted Regression in Equidistant Time Series under Short Memory

Description

Optimal Bandwidth Estimation for Locally Weighted Regression in Equidistant Time Series under Short Memory

Usage

select_bwidth(
  y,
  smoothing_options = set_options(),
  bwidth_start = NULL,
  inflation_rate = c("optimal", "naive"),
  correction_factor = FALSE,
  autocor = TRUE,
  drop = NULL,
  error_model = c("free", "ARMA"),
  nar_lim = c(0, 3),
  nma_lim = c(0, 3),
  arma_mean = FALSE
)

Arguments

y

a numerical vector or a time series object of class ts or that can be transformed with as.ts to an object of class ts; for these observations, trend and seasonality will be obtained.

smoothing_options

an S4 object of class smoothing_options, which is returned by the function set_options; it includes details about the options to consider in the locally weighted regression such as the order of polynomial and the bandwidth for smoothing among others.

bwidth_start

a single numeric value that is only relevant if the slot bwidth in smoothing_options is set to NA; as the bandwidth will then be selected automatically, bwidth_start sets the initial bandwidth for the algorithm; the default, bwidth_start = NULL, corresponds to bwidth_start = 0.1 for a local linear trend and to bwidth_start = 0.2 for a local cubic trend.

inflation_rate

a character vector of length one that indicates, which inflation rate to use in the bandwidth selection; for a local linear trend, we have inflation_rate = "optimal" as the default, for a local cubic trend it is inflation_rate = "naive", which correspond to inflation rates of 5/7 and 9/13, respectively.

correction_factor

A logical vector of length one; theoretically, a larger bandwidth to estimate the sum of autocovariances from residuals of pilot trend and seasonality estimates is advisable than for estimating trend and seasonality; for correction_factor = TRUE, this is implemented; the default is correction_factor = FALSE, because it was found that setting this argument to TRUE often overestimates the bandwidth.

autocor

a logical vector of length one; indicates whether to consider autocorrelated errors (TRUE) or independent but identically distributed errors (FALSE); the default is autocor = TRUE.

drop

a numeric vector of length one that indicates the proportion of the observations to not include at each boundary in the bandwidth estimation process, if a bandwidth is selected automatically; the default is drop = NULL, which corresponds to drop = 0.05 for a local linear trend and to drop = 0.1 for a local cubic trend.

error_model

a character vector of length one that indicates whether for autocor = TRUE the sum of autocovariances of the errors is obtained purely nonparametrically ("free") or whether an autoregressive moving-average (ARMA) model is assumed "ARMA"; the default is error_model = "free".

nar_lim

only valid for error_model = "ARMA"; set the minimum and maximum AR order to check via the BIC in each iteration of the algorithm via a two-element vector.

nma_lim

only valid for error_model = "ARMA"; set the minimum and maximum MA order to check via the BIC in each iteration of the algorithm via a two-element vector.

arma_mean

only valid for error_model = "ARMA"; decide whether to include an estimate of the mean in the ARMA fitting for the detrended series.

Details

See further details in the documentation of the function deseats, where this function is applied internally by default to select an optimal bandwidth.

Value

The function returns a list with different components:

bopt

the obtained optimal bandwidth.

bwidths

the obtained bandwidth for each iteration of the IPI-algorithm.

Imk

the final estimate of I[m^{(k)}].

sum_autocov

the final estimate of the sum of autocovariances.

Author(s)

References

Examples

Xt <- log(EXPENDITURES)
select_bwidth(Xt)


[Package deseats version 1.1.0 Index]