tupolyn: Time-uncertain polynomial regression

Description Usage Arguments Examples

View source: R/a_tuPN.R

Description

tupolyn polynomial regression of the N-th order of time-uncertain time series.

Usage

1
tupolyn(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 polynomial order with the default value set to polyorder=3, 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.

polyorder

Order of the polynomial regression.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# 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))

# Set parameters and run the polynomial regression:
polyorder=2
n.sim=1000
PN=tupolyn(y=y,ti.mu=ti.mu,ti.sd=ti.sd,polyorder=polyorder,n.sim=n.sim, CV=TRUE)

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

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

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