BaSAR.local: Local BSA

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/BaSAR.R

Description

A windowed BSA that computes the frequency locally.

Usage

1
BaSAR.local(data, start, stop, nsamples, tpoints, nbackg, window)

Arguments

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

tpoints

vector of time points, in seconds

nbackg

number of background functions to be added to the model

window

length of window, in number of data points

Details

BaSAR.local uses BaSAR.post with windowing, so it computes a local posterior. The window works in the way that at each time point i, the posterior will be calculated using the data from i-window to i+window.

Value

A list containing:

omega

1D vector of the omega sampled

p

2D posterior distribution over omega and time

Author(s)

Emma Granqvist, Matthew Hartley and Richard J Morris

References

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.

See Also

BaSAR.post

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
require(fields)
# Create time series with changing omega
tpoints = seq(from=1, to=200, length=200)
dpoints <- c()
for (i in 1:200) { dpoints[i] <- sin((0.5+i*0.005)*i) }
# Plot time series
plot(dpoints, type="l", col="blue", xlab="t", ylab="d(t)")
# Run BaSAR with windowing to get 2D posterior over omega and time
r <- BaSAR.local(dpoints, 2, 30, 100, tpoints, 0, 10)
# Plot the resulting 2D posterior density function
# with time on x-axis and omega on y-axis
require(fields)
image.plot(tpoints,r$omega,r$p, col=rev(heat.colors(100)),
ylab=expression(omega),xlab="t")

JIC-CSB/BaSAR documentation built on May 21, 2019, 1:41 p.m.