sim.HCAR: Simulate samples from a HCAR model.

Description Usage Arguments Value Author(s) See Also

View source: R/HCAR.sim.R

Description

Simulate samples from a hierarchical conditional-autoregressive model.

Usage

1
sim.HCAR(psi, data, n.samples)

Arguments

psi

A vector of the length of all parameters used for the importance sampler. When the spatial weight matrix W for individual unit is supplied in the data, the first four entries of psi are

psi[1] = rho,

the spatial coefficient parameter for individual units,

psi[2] = lambda,

the spatial coefficient parameter for district level units,

psi[3] = sigma.e

the marginal variance parameter for individual units,

psi[4] = sigma.u

the marginal variance parameter for district level units.

Then the rest of entries are values for the linear coefficient beta. Otherwise, the function assumes that there is no spatial correlation among the individual unit and the first three entries are used to specify lambda, sigma.e, sigma.u and the rest for beta.

data

A list or an environment contains the following variables

y,

the observed linear response,

X,

the design matrix for the fixed effects,

W,

the spatial weight matrix for individual units,

M,

the spatial weight matrix for district level units,

Z,

the design matrix for the random effects,

In

an n by n identity matrix, where n is the number of individual spatial units,

Ik

a k by a indentity matrix, where k is the number of distrct level unites.

n.samples

the number of Monte Carlo samples

Value

psi

the importance sampler value used for generating the samples,

n.samples

the number of Monte Carlo samples,

u.y

the Monte Carlo samples of the randome effects,

lpsi

the unnormalsied likelihood components evaluated at psi,

const.psi

the constant in the likelihood function evaluated at psi

Author(s)

Zhe Sha zhesha1006@gmail.com

See Also

mcl.HCAR, OptimMCL.HCAR, summary.OptimMCL.HCAR


mclcar documentation built on Jan. 8, 2022, 5:07 p.m.