plot.tuts_ar1: Plots and visual diagnostics of tuts_ar1 objects

Description Usage Arguments Examples

View source: R/a_tuar1.R

Description

plot.tuts_ar1(x,type,...) generates plots and visual diagnostics of tuts_ar1 objects.

Usage

1
2
## S3 method for class 'tuts_ar1'
plot(x, type, ...)

Arguments

x

A tuts_ar1 object.

type

plot type with the following options:
- 'predTUTS' plots one step predictions of the model.
- 'par' plots distributions of parameters of the model.
- 'volatility' plots volatility realizations.
- 'GR' plots Gelman-Rubin diagnostics.
- 'cv' plots 5-fold cross validation.
- 'mcmc' plots diagnostics of MCMC/JAGS objects.

...

list of optional parameters:
- burn: burn-in parameter ranging from 0 to 0.7 with default value set to 0.
- CI: credible interval ranging from 0.3 to 1 with default value set to 0.95.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Note: Most of models included in tuts package are computationally intensive. In the example
# below I set parameters to meet CRAN<e2><80><99>s testing requirement of maximum 5 sec per example.
# A more practical example would contain N=50 in the first line of the code and n.sim=10000.

#1. Import or simulate the data (a simulation is chosen for illustrative purposes):
DATA=simtuts(N=10,Harmonics=c(4,0,0), sin.ampl=c(10,0, 0), cos.ampl=c(0,0,0),
            trend=0,y.sd=2, ti.sd=0.2)
y=DATA$observed$y.obs
ti.mu=DATA$observed$ti.obs.tnorm
ti.sd= rep(0.2, length(ti.mu))

#2. Fit the model:
n.sim=1000
TUAR1=tuar1(y=y,ti.mu=ti.mu,ti.sd=ti.sd,n.sim=n.sim,CV=TRUE,n.cores=2)

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

tuts documentation built on May 1, 2019, 7:56 p.m.