Learn R Programming

MetaLandSim (version 1.0.4)

accept.calculate: Calculate acceptance rates in MCMC chains

Description

Calculate acceptance rates of parameters in the IFM.

Usage

accept.calculate(x, model = c("naive", "missing", "robust"))

Arguments

x

A named list with the MCMC chains estimated by ifm.naive.MCMC, ifm.missing.MCMC, or ifm.robust.MCMC.

model

Either "naive", "missing", or "robust"

Value

Named list containing MCMC chain acceptance rates. Names are built from the input list, e.g., for model=``naive":

acc.b.chain

Acceptance rates of parameter b

acc.e.chain

Acceptance rates of parameter e

acc.y.chain

Acceptance rates of parameter y

acc.alpha.chain

Acceptance rates of parameter alpha

acc.x.chain

Acceptance rates of parameter x

Examples

Run this code
# NOT RUN {
data(simulatedifm)

# Here, we run a chain with random initial values:
init1=list(alpha=runif(1,1,30), b=runif(1,0,5),y=runif(1,0,20),e=runif(1,0,1),x=runif(1,0,5))

inm1 <- ifm.naive.MCMC(niter=1000,init=init1,z.data =
 z.sim,site.distance=sim.distance,site.area=sim.area,
  sd.prop.alpha=4,sd.prop.b=0.6,sd.prop.y=40,sd.prop.e=0.05,sd.prop.x=0.4,nthin=1,print.by=100)
accept.calculate(inm1,model='naive')

# }

Run the code above in your browser using DataLab