vrunge / ARRWestim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ARRWestim : An example

Installation of the package from github

devtools::install_github("vrunge/ARRWestim")

Data generation

We chose parameters

n <- 1000
phi <- 0.2
sdEta <- 0.5
sdNu <- 0.2

And generate a time series of length n using the dataARRW function

data <- dataRWAR(N = n, sdEta = sdEta, sdNu = sdNu, type = "rand1",  nbSeg = 10, seed = 8)

We can plot the time series

plotRWAR(data)

and the diff-1 time-series and show the changepoints

plotRWARdiff(data)

Variance analysis

We robustly estimate the variances of different lag-k data

nb <- 10
v <- estimVar(data$y, nbK = nb)

and find all parameters (the AR and RW variances and phi AR(1) autocorrelation parameter)

bestParameters(data$y, nbK = nb)

Least square comparison

This last function plots the vectors to compare in the least-square criterion

plotVarVarEstim(v, sdEta, sdNu, phi, nbK = nb)

About


Languages

Language:R 100.0%