Learn R Programming

DeCAFS (version 3.2.3)

estimateParameters: Estimate parameter in the Random Walk Autoregressive model

Description

This function perform robust estimation of parameters in the Random Walk plus Autoregressive model using a method of moments estimator. Returns a list of estimates that can be employed as an argument for parameter modelParam to run DeCAFS().

Usage

estimateParameters(
  y,
  K = 15,
  phiLower = 0,
  phiUpper = 0.999,
  sdEtaUpper = Inf,
  sdNuUpper = Inf,
  model = c("RWAR", "AR", "RW")
)

Arguments

y

A vector of observations

K

The number of K-lags differences of the data to run the robust estimation over. Default set at 15.

phiLower

Smallest value of the autocorrelation parameter. Default set at 0.

phiUpper

Highest value of the autocorrelation parameter. Default set at 0.99.

sdEtaUpper

Highest value of the RW standard deviation. Default set at Inf

sdNuUpper

Highest value of the AR(1) noise standard deviation. Default set at Inf

model

Constrain estimation to an edge case of the RWAR model. Defaults to "RWAR". To fit an AR model only with a piece-wise constant signal, specify "AR". To fit a a random walk plus noise, specify "RW".

Value

A list containing:

sdEta

the SD of the drift (random fluctuations) in the signal,

sdNu

the SD of the AR(1) noise process,

phi

the autocorrelation parameter of the noise process.

Examples

Run this code
# NOT RUN {
set.seed(42)
y <- dataRWAR(n = 1e3, phi = .5, sdEta = 1, sdNu = 3,  jumpSize = 15, type = "updown", nbSeg = 5)$y
estimateParameters(y)
# }

Run the code above in your browser using DataLab