Function sample.theta()
samples $\theta$ from its prior distribution.
prob.psi1(phi,lognormally.distributed=TRUE)
prob.psi2(phi,lognormally.distributed=TRUE)
prob.theta(theta,phi,lognormally.distributed=FALSE)
sample.theta(n=1,phi)
FALSE
meaning to assume a Gaussian distribution and TRUE
meaning to use a lognormal distribution.sample.theta()
, the number of observations
to takemvtnorm
to calculate the
probability density under the assumption that the PDF is lognormal.
One implication would be that phi$psi2.apriori$mean
and phi$psi1.apriori$mean
are the means of the
logarithms of the elements of psi1
and psi2
(which are thus assumed to be positive). The sigma
matrix is
the covariance matrix of the logarithms as well.
In these functions, interpretation of argument phi
depends on
the value of Boolean argument lognormally.distributed
. Take
prob.theta()
as an example. If lognormally.distributed
is TRUE
, then log(theta)
is normally distributed with
mean phi$theta.aprior$mean
and variance
phi$theta.apriori$sigma
. If FALSE
, theta
is
normally distributed with mean phi$theta.aprior$mean
and
variance phi$theta.apriori$sigma
. Interpretation of phi$theta.aprior$mean
depends on the value of
lognormally.distributed
: if TRUE
it is the expected
value of log(theta)
; if FALSE
, it is the expectation of
theta
.
The reason that prob.theta
has a different default value for
lognormally.distributed
is that some elements of theta
might be negative, contraindicating a lognormal distribution.
p.eqn4.supp
, stage1
, p.eqn8.supp
data(toys)
prob.psi1(phi=phi.toy)
prob.psi2(phi=phi.toy)
prob.theta(theta=theta.toy,phi=phi.toy)
sample.theta(n=4,phi=phi.toy)
Run the code above in your browser using DataLab