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 bspec object. |
size |
the sample size. |
two.sided |
a logical flag indicating whether the drawn
samples are supposed to correspond to the one-sided or
two-sided spectrum. |
... |
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, bspec@web.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")