Learn R Programming

LSEbootLS (version 0.1.0)

application: Calculate the bootstrap LSE for a long memory model

Description

Bootstrap procedure to approximate the sampling distribution of the LSE for time series linear regression with errors following a Locally Stationary process.

Usage

application(
  formula,
  data,
  start,
  d.order,
  s.order,
  N,
  S,
  B = 1,
  nr.cores = 1,
  seed = 123
)

Value

A list with the following elements:

  • coeff: A tibble of estimated model coefficients, including intercepts, regression coefficients (\(\beta\)), and coefficients of the \(\delta\) and \(\alpha\) polynomials. Contains columns for coefficient name, estimate, t-value and p-value.

  • estimation: A matrix of bootstrap replicates for regression coefficients (\(\beta\)).

  • delta: A matrix of bootstrap replicates for the \(\delta\) polynomial coefficients.

  • alpha: A matrix of bootstrap replicates for the \(\alpha\) polynomial coefficients.

Arguments

formula

(type: formula) an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under ‘Details’.

data

(type: data.frame) data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model.

start

(type: numeric) numeric vector, initial values for parameters to run the model.

d.order

(type: numeric) polynomial order, where d is the ARFIMA parameter.

s.order

(type: numeric) polynomial order noise scale factor.

N

(type: numeric) sample size of each block.

S

(type: numeric) shifting places from block to block. Observe that the number of blocks M is determined by the following formula \(M = \left\lfloor \frac{T-N}{S} + 1 \right\rfloor\), where \(\left\lfloor . \right\rfloor\) takes a single numeric argument x and returns a numeric vector containing the integers formed by truncating the values in x toward 0.

B

(type: numeric) bootstrap replicates, 1 by default.

nr.cores

(type: numeric) number of CPU cores to be used for parallel processing. 1 by default.

seed

(type: numeric) random number generator seed to generate the bootstrap samples.

Details

This function estimates the parameters in the linear regression model for \(t = 1, ..., T\),

$$Y_{t,T} = X_{t,T} \beta + \epsilon_{t,T},$$

where the error term \(\epsilon_{t,T}\) follows a Locally Stationary Autoregressive Fractionally Integrated Moving Average (LS-ARFIMA) structure, given by:

$$\epsilon_{t,T} =(1 - B)^{-d(u)} \sigma(u)\eta_t,$$

where u=t/T in [0,1], \(d(u)\) represents the long-memory parameter, \(\sigma(u)\) is the noise scale factor, and \(\{\eta_t\}\) is a white noise sequence with zero mean and unit variance.

Particularly, we model \(d(u)\) and \(\sigma(u)\) as polynomials of order \(d.order\) and \(s.order\) respectively.

$$d(u) = \sum_{i=0}^{d.order} \delta_i u^i,$$ $$\sigma(u) = \sum_{j=0}^{s.order} \alpha_j u^j,$$

For more details, see references.

References

Ferreira G., Mateu J., Vilar J.A., Muñoz J. (2020). Bootstrapping regression models with locally stationary disturbances. TEST, 30, 341-363.

Examples

Run this code
n    <- length(USinf)
shift<-201
u1<-c((1:shift)/shift,rep(0, n-shift))
u2<-c(rep(0, shift),(1:(n-shift))/(n-shift))
u<-(1:n)/n
switch <- c(rep(1,shift), rep(0, n-shift))
x1<-switch*u
x2<-(1-switch)*u

test <- data.frame(USinf, x1=x1, x2=x2)

application(formula=USinf~x1+x2,data=test,N=150,S=50,B=10,
start = c(0.16,2.0,-7,8,-3,0.25,-0.25,0.01),
d.order=4,s.order=2,nr.cores=1)

Run the code above in your browser using DataLab