| likelihood {bspec} | R Documentation |
Prior density, likelihood, and posterior density functions for the
posterior distributions specified through a bspec object.
dprior(x, ...) likelihood(x, ...) dposterior(x, ...) ## S3 method for class 'bspec': dprior(x, theta, two.sided=x$two.sided, log=FALSE, ...) ## S3 method for class 'bspec': likelihood(x, theta, two.sided=x$two.sided, log=FALSE, ...) ## S3 method for class 'bspec': dposterior(x, theta, two.sided=x$two.sided, log=FALSE, ...)
x |
a bspec object. |
theta |
a numeric vector of parameter values,
corresponding to the Fourier frequencies in the x$freq element. |
two.sided |
a logical flag indicating whether the
parameters theta correspond to the one-sided or
two-sided spectrum. |
log |
a logical flag indicating whether to return
logarithmic density (or likelihood) values. |
... |
Prior and posterior are both scaled inverse chi-squared distributions, and the likelihood is Normal.
A numeric function value.
Christian Roever, bspec@web.de
Roever, C., Meyer, R., Christensen, N. (2008): Modelling coloured noise. Arxiv preprint 0804.3853 [stat.ME], http://arxiv.org/abs/0804.3853, (submitted for publication).
bspec,
quantile.bspec,
expectation
lhspec <- bspec(lh, priordf=1, priorscale=0.6)
# draw sample from posterior:
posteriorsample <- sample(lhspec)
# plot the sample:
plot(lhspec)
lines(lhspec$freq, posteriorsample, type="b", col="red")
# compute prior, likelihood, posterior:
print(c("prior" = dprior(lhspec, posteriorsample),
"likelihood"= likelihood(lhspec, posteriorsample),
"posterior" = dposterior(lhspec, posteriorsample)))