Rev Language Reference

mvGammaScale

A move to scale a single continuous value by multiplying by a value drawn from a Gamma(lambda,1) distribution. Lambda is the tuning parameter that controls the size of the proposals.

Usage

mvGammaScale(RealPos x, RealPos lambda, Bool tune, RealPos weight, Probability tuneTarget)

Arguments

 x : RealPos ( pass by reference) The variable this move operates on. lambda : RealPos (pass by value) The strength of the proposal. Default : 1 tune : Bool (pass by value) Should we tune lambda during burnin? Default : TRUE weight : RealPos (pass by value) The weight how often on average this move will be used per iteration. Default : 1 tuneTarget : Probability (pass by value) The acceptance probability targeted by auto-tuning. Default : 0.44

Example

# Here is a simple example for conducting MCMC on the mean and sd of a Normal distribution.

# Uniform(0,1) priors on the mean and sd
mean ~ dnUnif(0,1)
sd ~ dnUnif(0,1)

# Dummy data (will not actually be analyzed)
data <- v(0.4,0.5,0.6)

# Clamping data
for (i in 1:data.size()){ outcomes[i] ~ dnNorm(mean,sd); outcomes[i].clamp(data[i]) }

# Initializing move and monitor counters
mvi = 1
mni = 1

# Adding Gamma scale moves for the mean and sd (THIS MOVE IS HERE)
moves[mvi++] = mvGammaScale(mean)
moves[mvi++] = mvGammaScale(sd)

# Instantiating the model
mymodel = model(outcomes)

# Adding screen monitor for the mean
monitors[mni++] = mnScreen(mean, printgen=1000)

# Creating MCMC object
mymcmc = mcmc(mymodel, moves, monitors)

# Running MCMC under the prior
mymcmc.run(30000,underPrior=TRUE);