precision_builder {sim2Dpredictr} | R Documentation |
Construct a Precision Matrix
Description
This function constructs the precision matrix for a Conditional Autoregression (CAR).
Usage
precision_builder(
im.res,
tau = 1,
alpha = 0.75,
neighborhood = "ar1",
weight = "binary",
phi = 1,
r = NULL,
w = NULL,
h = NULL,
digits.Q = 10
)
Arguments
im.res |
A vector defining the dimension of spatial data. The first entry is the number of rows and the second entry is the number of columns. |
tau |
A vector containing precision parameters. If of length 1, then
all precisions are assumed equal. Otherwise the length of |
alpha |
A scalar value between 0 and 1 that defines the strength of
correlations. Note that when |
neighborhood |
Defines the neighborhood within which conditional
correlations are non-zero. This differs from use in
|
weight |
Determines how weights are assigned. |
phi |
When |
r |
If |
w , h |
If |
digits.Q |
Determines the number of digits to round entries in the precision matrix. Default is 10. |
Details
This formulation of the CAR model is based on a formulation found
in (Banerjee et al. 2015) where the joint distribution
of the of the conditionally specified random variables are assumed to be
and all neighbors are
weighted 1. When weights other than 1 are desired, the joint distribution
is
, e.g. as in
(Jin et al. 2005).
Value
A (precision) matrix.
References
Banerjee S, Carlin BP, Gelfand AE (2015). Hierarchical Modeling and Analysis for Spatial Data, Second edition. Chapman & Hall/CRC, Boca Raton, Florida.
Jin X, Carlin BP, Banerjee S (2005). “Generalized Hierarchical Multivariate CAR Models for Areal Data.” Biometrics, 61(4), 950-961. doi:10.1111/j.1541-0420.2005.00359.x.
Examples
## Not run:
precision_builder(im.res = c(3, 3), tau = 1, alpha = 0.75,
neighborhood = "ar1")
## binary weights
precision_builder(im.res = c(3, 3), tau = 1, alpha = 0.75,
neighborhood = "round", r = 3)
## weights based on distance
precision_builder(im.res = c(3, 3), tau = 1, alpha = 0.75,
weight = "distance", phi = 1,
neighborhood = "round", r = 3)
precision_builder(im.res = c(3, 3), tau = 1, alpha = 0.75,
neighborhood = "rectangle", w = 2, h = 2)
## End(Not run)