BaSAR.plotperiod: Plotting over period

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

View source: R/BaSAR.R

Description

Calculates a normalised posterior over period range.

Usage

1

Arguments

omega

1D vector of omega

p

posterior distribution over omega

Details

The other BaSAR functions return the posterior over omega (angular frequency). If the user wants to plot the result over period instead, this function takes the results from e.g. BaSAR.post and computes the posterior over an evenly spaced vector of the period. This is done using linear interpolation of the posterior over omega.

Value

A list containing:

period

1D vector of the period (in seconds), evenly sampled

normp

normalised posterior distribution over period

omega

1D vector of the omega, corresponding to period

Author(s)

Emma Granqvist, Matthew Hartley and Richard J Morris.

See Also

BaSAR.post

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Create time series omega = 0.5
tpoints = seq(from=1, to=200, length=200)
dpoints = sin(0.5 * tpoints) + 0.1 * rnorm(200, 0, 1)
# Plot time series
plot(dpoints, type="l", col="blue", xlab="t", ylab="d(t)")
# Run BaSAR to get normalized posterior distirbution
r <- BaSAR.post(dpoints, 6, 30, 100, 0, tpoints)
# Plot the resulting posterior density function
plot(r$omega, r$normp, xlim=c(0:1), type="h", col="red", ylab="PDF",
xlab=expression(omega))
# Calculate distribution over period interval 6-30 seconds
r2 <- BaSAR.plotperiod(r$omega,r$normp)
# Plot distribution over period instead
plot(r2$period, r2$normp, type="h", col="red", ylab="PDF",
xlab="Period in seconds")

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