multiNetLeroux {netcmc} | R Documentation |
A function that generates samples for a multivariate fixed effects, spatial, and network model.
Description
This function that generates samples for a multivariate fixed effects, spatial, and network model, which is given by
The covariates for the th individual in the
th spatial unit or other grouping are included in a
vector
. The corresponding
vector of fixed effect parameters relating to the
th response are denoted by
, which has an assumed multivariate Gaussian prior with mean
and diagonal covariance matrix
that can be chosen by the user. A conjugate Inverse-Gamma prior is specified for
, and the corresponding hyperparamaterers (
,
) can be chosen by the user.
Spatial correlation in these areal unit level random effects is most often modelled by a conditional autoregressive (CAR) prior distribution. Using this model
spatial correlation is induced into the random effects via a non-negative spatial adjacency matrix , which defines how spatially close the
areal units are to each other. The elements of
can be binary or non-binary, and the most common specification is that
if a pair of areal units (
,
) share a common border or are considered neighbours by some other measure, and
otherwise. Note,
for all
.
measures the variance of these random effects for the
th response, where a conjugate Inverse-Gamma prior is specified for
and the corresponding hyperparamaterers (
,
) can be chosen by the user.
controls the level of spatial autocorrelation. A non-conjugate uniform prior is specified for
.
The vector of random effects for the
th alter is denoted by
, while the
vector of isolation effects for all
outcomes is denoted by
, and both are assigned multivariate Gaussian prior distributions. The unstructured covariance matrix
captures the covariance between the
outcomes at the network level, and a conjugate Inverse-Wishart prior is specified for this covariance matrix
. The corresponding hyperparamaterers (
,
) can be chosen by the user.
The exact specification of each of the likelihoods (binomial, Gaussian, and Poisson) are given below:
Usage
multiNetLeroux(formula, data, trials, family, squareSpatialNeighbourhoodMatrix,
spatialAssignment, W, numberOfSamples = 10, burnin = 0, thin = 1, seed = 1,
trueBeta = NULL, trueSpatialRandomEffects = NULL, trueURandomEffects = NULL,
trueSpatialTauSquared = NULL, trueSpatialRho = NULL,
trueVarianceCovarianceU = NULL, trueSigmaSquaredE = NULL,
covarianceBetaPrior = 10^5, a1 = 0.001, b1 = 0.001, xi, omega, a3 = 0.001,
b3 = 0.001, centerSpatialRandomEffects = TRUE, centerURandomEffects = TRUE)
Arguments
formula |
A formula for the covariate part of the model using a similar syntax to that used in the lm() function. |
data |
An optional data.frame containing the variables in the formula. |
trials |
A vector the same length as the response containing the total number of trials
|
family |
The data likelihood model that must be “gaussian", “poisson" or “binomial". |
squareSpatialNeighbourhoodMatrix |
An |
W |
A matrix |
spatialAssignment |
The binary matrix of individual's assignment to spatial area used in the model fitting process. |
numberOfSamples |
The number of samples to generate pre-thin. |
burnin |
The number of MCMC samples to discard as the burn-in period. |
thin |
The value by which to thin |
seed |
A seed for the MCMC algorithm. |
trueBeta |
If available, the true value of |
trueSpatialRandomEffects |
If available, the true values of |
trueURandomEffects |
If available, the true values of |
trueSpatialTauSquared |
If available, the true values of |
trueSpatialRho |
If available, the true value of |
trueVarianceCovarianceU |
If available, the true value of |
trueSigmaSquaredE |
If available, the true value of |
covarianceBetaPrior |
A scalar prior |
a1 |
The shape parameter for the Inverse-Gamma distribution
relating to the spatial random effects |
b1 |
The scale parameter for the Inverse-Gamma distribution
relating to the spatial random effects |
xi |
The degrees of freedom parameter for the Inverse-Wishart
distribution relating to the network random effects |
omega |
The scale parameter for the Inverse-Wishart distribution
relating to the network random effects |
a3 |
The shape parameter for the Inverse-Gamma distribution
relating to the error terms |
b3 |
The scale parameter for the Inverse-Gamma distribution
relating to the error terms |
centerSpatialRandomEffects |
A choice to center the spatial random effects after each iteration of the MCMC sampler. |
centerURandomEffects |
A choice to center the network random effects after each iteration of the MCMC sampler. |
Value
call |
The matched call. |
y |
The response used. |
X |
The design matrix used. |
standardizedX |
The standardized design matrix used. |
squareSpatialNeighbourhoodMatrix |
The spatial neighbourhood matrix used. |
spatialAssignment |
The spatial assignment matrix used. |
W |
The network matrix used. |
samples |
The matrix of simulated samples from the posterior distribution of each parameter in the model (excluding random effects). |
betaSamples |
The matrix of simulated samples from the posterior
distribution of |
spatialTauSquaredSamples |
Type: matrix. The matrix of simulated samples from the posterior
distribution of |
spatialRhoSamples |
The vector of simulated samples from the posterior
distribution of |
varianceCovarianceUSamples |
The matrix of simulated samples from the posterior
distribution of |
spatialRandomEffectsSamples |
The matrix of simulated samples from the posterior
distribution of spatial random effects |
uRandomEffectsSamples |
The matrix of simulated samples from the posterior
distribution of network random effects |
sigmaSquaredESamples |
The vector of simulated samples from the posterior
distribution of |
acceptanceRates |
The acceptance rates of parameters in the model from the MCMC sampling scheme . |
spatialRandomEffectsAcceptanceRate |
The acceptance rates of spatial random effects in the model from the MCMC sampling scheme. |
uRandomEffectsAcceptanceRate |
The acceptance rates of network random effects in the model from the MCMC sampling scheme. |
timeTaken |
The time taken for the model to run. |
burnin |
The number of MCMC samples to discard as the burn-in period. |
thin |
The value by which to thin |
DBar |
DBar for the model. |
posteriorDeviance |
The posterior deviance for the model. |
posteriorLogLikelihood |
The posterior log likelihood for the model. |
pd |
The number of effective parameters in the model. |
DIC |
The DIC for the model. |
Author(s)
George Gerogiannis