Simulate samples from a hierarchical conditional-autoregressive model.
sim.HCAR(psi, data, n.samples)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
the spatial coefficient parameter for individual units,
the spatial coefficient parameter for district level units,
the marginal variance parameter for individual units,
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.
A list or an environment contains the following variables
the observed linear response,
the design matrix for the fixed effects,
the spatial weight matrix for individual units,
the spatial weight matrix for district level units,
the design matrix for the random effects,
an n by n identity matrix, where n is the number of individual spatial units,
a k by a indentity matrix, where k is the number of distrct level unites.
the number of Monte Carlo samples
the importance sampler value used for generating the samples,
the number of Monte Carlo samples,
the Monte Carlo samples of the randome effects,
the unnormalsied likelihood components evaluated at psi,
the constant in the likelihood function evaluated at psi