sample.bspec {bspec} | R Documentation |
Function to generate samples from the spectrum's posterior
distribution specified through the supplied bspec
object argument.
## S3 method for class 'bspec' sample(x, size = 1, two.sided = x$two.sided, ...)
x |
a |
size |
the sample size. |
two.sided |
a |
... |
currently unused. |
The posterior distribution is a product of independent scaled inverse chi-squared distributions.
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.
Christian Roever, christian.roever@med.uni-goettingen.de
# 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")