Rev Language Reference


mvRandomNaturalWalk - Random walk on natural numbers

A move that performs random walk on a natural number variable. The displacement of the random walk is exactly one step, either positive or negative.

Usage

mvRandomNaturalWalk(Natural x, RealPos weight, Probability tuneTarget)

Arguments

x : Natural (<stochastic> pass by reference)
The variable on which this move operates.
weight : RealPos (pass by value)
The weight determines the relative frequency with which this move will be attempted. For details, see the description of the 'moveschedule' parameter on the documentation page for 'mcmc()'.
Default : 1
tuneTarget : Probability (pass by value)
The acceptance probability targeted by auto-tuning.
Default : 0.44

Example


p <- 0.8
x ~ dnGeom(p)

moves[1] = mvRandomNaturalWalk(x, weight=1.0)
monitors[1] = mvScreen(printgen=1000, x)

mymodel = model(p)
mymcmc = mcmc(mymodel, monitors, moves)
mymcmc.burnin(generations=20000,tuningInterval=100)
mymcmc.run(generations=200000)

See Also