tuar1: Time-uncertain AR(1) model

Description Usage Arguments Examples

View source: R/a_tuar1.R

Description

tuar1 estimates unbiased parameters of AR(1) model.

Usage

1
tuar1(y, ti.mu, ti.sd, n.sim, CV = FALSE, ...)

Arguments

y

A vector of observations.

ti.mu

A vector of estimates of timing of observations.

ti.sd

A vector of standard deviations of timing.

n.sim

A number of simulations.

CV

cross-validation indicator.

...

A list of optional parameters. The list contains thinning parameter, with the default value set to Thin=4, and the number of mcmc chains with the default value set to n.chains=2.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Import or simulate the data (simulation is chosen for illustrative purposes):
DATA=simtuts(N=50,Harmonics=c(10,30,0), sin.ampl=c(10,10, 0), cos.ampl=c(0,0,0),
trend=0,y.sd=3, ti.sd=1)
y=DATA$observed$y.obs
ti.mu=DATA$observed$ti.obs.tnorm
ti.sd= rep(1, length(ti.mu))

# Run the tuar1 model fitting with cross validation:
n.sim=1000
TUAR1=tuar1(y=y,ti.mu=ti.mu,ti.sd=ti.sd,n.sim=n.sim, CV=TRUE)

# Generate summary results (optional parameters are listed in brackets):
summary(TUAR1)                                # Summary tables (CI, burn).

# Plots and diagnostics (optional parameters are listed in brackets):
plot(TUAR1,type='predTUTS')                   # One step out of salmple predictions of the model (CI, burn).
plot(TUAR1,type='par', burn=0.4)              # Distributions of parameters of the AR(1) model (burn).
plot(TUAR1,type='mcmc')                       # mcmc diagnostics.
plot(TUAR1,type='cv', burn=0.4, CI=0.9)       # 5 fold cross validation plot(CI, burn).
plot(TUAR1,type='GR')                         # Gelman-Rubin diagnostic (CI, burn).
plot(TUAR1,type='volatility')                 # Volatility realizaitons.

PeterFranke/tuts documentation built on May 30, 2019, 6:24 a.m.