Description Usage Arguments Details Value Author(s) References See Also Examples
Function for automated model comparison which stops adding background functions when model ratio > 1.
1 | BaSAR.auto(data, start, stop, nsamples, nbackg, tpoints)
|
data |
data as a 1-dimensional vector |
start |
lower limit of period of interest, in seconds |
stop |
upper limit of period of interest, in seconds |
nsamples |
number of samples within the interval start-stop |
nbackg |
number of background functions to be added to the model |
tpoints |
vector of time points, in seconds |
This is a wrapper function that uses BaSAR.modelratio
, and automatically adds more background functions until the model ratio is > 1, or the maximum number of background functions (nbackg
) has been reached. It will warn if the max was reached first, instead of the modelratio goal.
Plot log of posterior probability distribution and visually inspect if there are additional frequencies present. If there are, BaSAR.nest
should be used instead for model comparison.
A list containing:
normp |
1D normalized posterior distribution over omega |
omega |
1D vector of the omega sampled |
stats |
list of statistics from the probability distribution |
modelratio |
final model ratio |
model |
no of background functions added to the model |
Emma Granqvist, Matthew Hartley and Richard J Morris.
Granqvist, E., Oldroyd, G. E. and Morris, R. J. (2011) Automated Bayesian model development for frequency detection in biological time series. BMC Syst Biol 5, 97.
http://dx.doi.org/10.1186/1752-0509-5-97
Bretthorst, G. L. (1988) Bayesian spectrum analysis and parameter estimation. Lecture notes in statistics. New York: Springer-Verlag.
1 2 3 4 5 6 7 8 9 10 11 12 13 | require(polynom)
require(orthopolynom)
# Create time series with omega = 0.5 and a background trend
tpoints = seq(from=1, to=200, length=200)
dpoints = sin(0.5 * tpoints) - tpoints ^ 2 * 0.005 + 0.1 * rnorm(200, 0, 1)
# Plot time series
plot(dpoints, type="l", col="blue", xlab="t", ylab="d(t)")
# Run BaSAR with automated model selection for background trends
# up to a max of 4 background functions in this example
r = BaSAR.auto(dpoints, 6, 600, 100, 4, tpoints)
# Plot the resulting posterior density function, and check which model was selected
plot(r$omega, r$normp, xlim=c(0:1), type="h", col="red", ylab="PDF",
xlab=expression(omega))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.