Learn R Programming

rcppbugs (version 0.1.4.2)

mcmc.distributions: Create a stochastic rcppbugs object.

Description

Create stochastic objects in the spirit of PyMC.

Usage

mcmc.normal(x, mu, tau, observed = FALSE) mcmc.uniform(x, lower, upper, observed = FALSE) mcmc.gamma(x, alpha, beta, observed = FALSE) mcmc.beta(x, alpha, beta, observed = FALSE) mcmc.bernoulli(x, p, observed = FALSE) mcmc.binomial(x, n, p, observed = FALSE)

Arguments

x
the initial value of the object
mu
the mean for normally distributed objects
tau
the precision of normally distributed objects
lower
the lower limit of the uniform distribution
upper
the upper limit of the uniform distribution
alpha
the shape parameter of the gamma distribution
beta
the scale parameter of the gamma distribution
n
the sample size of a binomial distribution
p
the success rate in bernoulli or binomial distributions
observed
whether the object should be treated as constant data or simulated over the MCMC chain

Value

an rcppbugs object corresponding to the particular distribution requested

References

https://github.com/armstrtw/CppBugs

See Also

logp

Examples

Run this code

b <- mcmc.normal(rnorm(10),mu=0,tau=0.0001)
tau <- mcmc.gamma(runif(1),alpha=0.1,beta=0.1)
b.unif <- mcmc.uniform(runif(1),lower=0,upper=100)

Run the code above in your browser using DataLab