sample.bspec {bspec} | R Documentation |
Posterior sampling
Description
Function to generate samples from the spectrum's posterior
distribution specified through the supplied bspec
object argument.
Usage
## S3 method for class 'bspec'
sample(x, size = 1, two.sided = x$two.sided, ...)
Arguments
x |
a |
size |
the sample size. |
two.sided |
a |
... |
currently unused. |
Details
The posterior distribution is a product of independent scaled inverse
\chi^2
distributions.
Value
A (numerical
) vector of samples from the posterior distribution
of the spectral parameters, of the same length as and corresponding to
the $freq
element of the supplied bspec
object.
Author(s)
Christian Roever, christian.roever@med.uni-goettingen.de
See Also
Examples
# determine spectrum's posterior distribution:
lhspec <- bspec(lh)
# plot 95 percent central intervals and medians:
plot(lhspec)
# draw and plot two samples from posterior distribution:
lines(lhspec$freq, sample(lhspec), type="b", pch=20, col="red")
lines(lhspec$freq, sample(lhspec), type="b", pch=20, col="green")
[Package bspec version 1.6 Index]