rp | R Documentation |
hyper2
objectUses Metropolis-Hastings to return random samples from the prior of a
hyper2
object
rp(n, H, startp = NULL, fcm = NULL, fcv = NULL, SMALL = 1e-06, l=loglik, fillup=TRUE, ...)
H |
Object of class |
n |
Number of samples |
startp |
Starting value for the Markov chain, with default
|
fcm , fcv |
Constraints as for |
SMALL |
Notional small value for numerical stability |
l |
Log-likelihood function with default |
fillup |
Boolean, with default |
... |
Further arguments, currently ignored |
Uses the implementation of Metropolis-Hastings from the MCE
package to sample from the posterior PDF of a hyper2
object.
If the distribution is Dirichlet, use rdirichlet()
to generate
random observations: it is much faster, and produces serially
independent samples. To return uniform samples, use
rp_unif()
(documented at dirichlet.Rd
).
Returns a matrix, each row being a unit-sum observation.
Function rp()
a random sample from a given normalized
likelihood function. To return a random likelihood function, use
rhyper2()
.
File inst/ternaryplot_hyper2.Rmd
shows how to use
Ternary::ternaryPlot()
with rp()
.
Robin K. S. Hankin
maxp
,loglik
,dirichlet
,rhyper2
rp(10,icons)
plot(loglik(rp(30,icons),icons),type='b')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.