Description Usage Arguments Examples
tubfs
spectral analysis of time-uncertain time series using the Bayesian Frequency Selection method
described in the paper "Frequency selection in palaeoclimate time series: a model-based
approach incorporating possible time uncertainty" by P. Franke, Prof B. Huntley, Dr A. Parnell.
1 |
y |
A vector of observations. |
ti.mu |
A vector of estimates/observed timings of observations. |
ti.sd |
A vector of standard deviations of timings. |
n.sim |
A number of simulations. |
CV |
cross-validation indicator. |
... |
optional arguments. n.chains: number of MCMC chains, default is set to 2. Thin: Thinning factor, default is set to 4.m: maximum number of significant frequencies in the data, the default is set to 5. polyorder: order of the polynomial regression component, the default is set to 3. freqs: set to a positive integer k returns a vector of k equally spaced frequencies in the Nyquist range. freqs can be provided as a vector of custom frequencies of interest. Set to 'internal' generates an equally spaced vector of frequencies in the Nyquist range |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # 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 Bayesian Frequency Selection model with cross validation of the model:
n.sim=1000
BFS=tubfs(y=y,ti.mu=ti.mu,ti.sd=ti.sd,freqs='internal',n.sim=n.sim,n.chains=2, CV=TRUE)
# Generate summary results (optional parameters are listed in brackets):
summary(BFS) # Summary results (CI, burn).
summary(BFS,burn=0.2) # Results after 20% of burn-in (CI.
# Plots and diagnostics (optional parameters are listed in brackets):
plot(BFS,type='periodogram') # spectral analysis (CI, burn).
plot(BFS,type='predTUTS', CI=0.99) # One step predictions of the model (CI, burn).
plot(BFS,type='cv') # 5 fold cross validation plot (CI, burn).
plot(BFS,type='GR') # Gelman-Rubin diagnostics (CI, burn).
plot(BFS,type='mcmc') # mcmc diagnostics.
plot(BFS,type='volatility') # Volatility realizaitons.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.