tuar1redf: Time-uncertain time-persistence AR(1) model

Description Usage Arguments Details Examples

View source: R/a_tuar1redf.R

Description

tuar1redf estimates parameters of the AR(1) model specified in "Climate Time Series Analysis" by M.Mudelsee. We modify the model to account for time-uncertainty.

Usage

1
tuar1redf(y, ti.mu, ti.sd, n.sim, n.chains = 2, 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.

n.chains

A number of chains.

CV

TRUE/FALSE cross-validation indicator.

...

list of optional parameters:
- n.chains: number of MCMC chains, the default number of chains is set to 2.
- Thin: thinning factor, the default values is set to 4.
- n.cores: number of cores used in cross-validation. No value or 'MAX' applies all the available cores in computation.

Details

Note: tuar1redf model estimates autocorrelation parameters with a certain bias unmitigated after the correction described in "Climate Time Series Analysis" by M.Mudelsee. In addition the model is not suitable for time series series generated with negative values of autocorrelation parameters. In contrast, the function tuar1 generates unbiased estimates of the parameters, and is not limited to positive values of parameters.
We include this model to provide suppodt for justificaiton of results obtained with the REDFIT method.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Note: Most of models included in tuts package are computationally intensive. In the example
# below I set parameters to meet CRAN'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
n.chains=2
AR1REDF=tuar1redf(y=y,ti.mu=ti.mu,ti.sd=ti.sd,n.sim=n.sim,n.chains=n.chains, CV=TRUE,n.cores=2)

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

#4. Generate plots and diagnostics of the model (optional parameters are listed in brackets):
plot(AR1REDF,type='predTUTS',burn=0.2,CI=0.99)  # One step out of salmple predictions (CI, burn).
plot(AR1REDF,type='par', burn=0.4)              # Distributions of parameters (burn).
plot(AR1REDF,type='mcmc')                       # MCMC diagnostics.
plot(AR1REDF,type='cv', burn=0.4)               # 5 fold cross validation (CI, burn).
plot(AR1REDF,type='GR', burn=0.4)               # Gelman-Rubin diagnostic (CI, burn).
plot(AR1REDF,type='tau')                        # realizations of persistence of time.

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