multiNetRand {netcmc} | R Documentation |
A function that generates samples for a multivariate fixed effects, grouping, and network model.
Description
This function that generates samples for a multivariate fixed effects, grouping, 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.
The vector of random effects for the $s$th group is denoted by
, which is assigned a joint Gaussian prior distribution with an unstructured covariance matrix
that captures the covariance between the
outcomes. A conjugate Inverse-Wishart prior is specified for the random effects covariance matrix
. The corresponding hyperparamaterers (
,
) can be chosen by the user.
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
multiNetRand(formula, data, trials, family, V, W, numberOfSamples = 10, burnin = 0,
thin = 1, seed = 1, trueBeta = NULL, trueVRandomEffects = NULL,
trueURandomEffects = NULL, trueVarianceCovarianceV = NULL,
trueVarianceCovarianceU = NULL, trueSigmaSquaredE = NULL,
covarianceBetaPrior = 10^5, xiV, omegaV, xi, omega, a3 = 0.001,
b3 = 0.001, centerVRandomEffects = 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". |
V |
The binary matrix of individual's assignment to groups used in the model fitting process. |
W |
A matrix |
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 |
trueVRandomEffects |
If available, the true values of |
trueURandomEffects |
If available, the true values of |
trueVarianceCovarianceV |
If available, the true value of |
trueVarianceCovarianceU |
If available, the true value of |
trueSigmaSquaredE |
If available, the true value of |
covarianceBetaPrior |
A scalar prior |
xiV |
The degrees of freedom parameter for the Inverse-Wishart
distribution relating to the grouping random effects |
omegaV |
The scale parameter for the Inverse-Wishart distribution
relating to the grouping 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 |
centerVRandomEffects |
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. |
V |
The grouping 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 |
varianceCovarianceVSamples |
The matrix of simulated samples from the posterior
distribution of |
varianceCovarianceUSamples |
The matrix of simulated samples from the posterior
distribution of |
vRandomEffectsSamples |
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. |
vRandomEffectsAcceptanceRate |
The acceptance rates of grouping 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