BaSAR.fine: Finely sampled BSA

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

View source: R/BaSAR.R

Description

High-resolution BSA which identifies the highest peak and samples more finely in its vicinity.

Usage

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

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

nbackg

number of background functions to be added to the model

tpoints

vector of time points, in seconds

Details

BaSAR.fine combines the function BaSAR.post with a Downhill-Simplex optimizer to identify the maximum peak in the frequency range chosen. It then samples over a narrower range around this peak for a high-resolution estimate of the strongest frequency. See e.g. Press (2002) for an example of Downhill-Simplex optimization.

Value

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

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

Press, W. H. (2002) Numerical recipes in C++: the art of scientific computing, 2nd Edition. Cambridge, UK: Cambridge University Press.

See Also

BaSAR.post

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Create time series with omega = 0.5 and add noise
tpoints = seq(from=1, to=200, length=200)
r1 = rnorm(200, 0, 1)
r2 = rnorm(200, 0, 1)
dpoints = sin(0.5 * tpoints + 0.1 * (0.5-r1)) + 0.7 * r2
# Plot time series
plot(dpoints, type="l", col="blue", xlab="t", ylab="d(t)")
# Run BaSAR 
r = BaSAR.fine(dpoints, 6, 600, 100, 0, tpoints)
# Plot the resulting probability density function around maximum peak 
plot(r$omega, r$normp, xlim=c(0:1), type="h", col="red", ylab="PDF", 
xlab=expression(omega))

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