This function that generates samples for a multivariate fixed effects and network model, which is given by
$$Y_{i_sr}|\mu_{i_sr} \sim f(y_{i_sr}| \mu_{i_sr}, \sigma_{er}^{2}) ~~~ i=1,\ldots, N_{s},~s=1,\ldots,S ,~r=1,\ldots,R,$$ $$g(\mu_{i_sr}) = \boldsymbol{x}^\top_{i_s} \boldsymbol{\beta}_{r} + \sum_{j\in \textrm{net}(i_s)}w_{i_sj}u_{jr}+ w^{*}_{i_s}u^{*}_{r},$$ $$\boldsymbol{\beta}_{r} \sim \textrm{N}(\boldsymbol{0}, \alpha\boldsymbol{I})$$ $$\boldsymbol{u}_{j} = (u_{1j},\ldots, u_{Rj}) \sim \textrm{N}(\boldsymbol{0}, \boldsymbol{\Sigma}_{\boldsymbol{u}}),$$ $$\boldsymbol{u}^{*} = (u_{1}^*,\ldots, u_{R}^*) \sim \textrm{N}(\boldsymbol{0}, \boldsymbol{\Sigma}_{\boldsymbol{u}}),$$ $$\boldsymbol{\Sigma}_{\boldsymbol{u}} \sim \textrm{Inverse-Wishart}(\xi_{\boldsymbol{u}}, \boldsymbol{\Omega}_{\boldsymbol{u}}),$$ $$\sigma_{er}^{2} \sim \textrm{Inverse-Gamma}(\alpha_{3}, \xi_{3}).$$
The covariates for the \(i\)th individual in the \(s\)th spatial unit or other grouping are included in a \(p \times 1\) vector \(\boldsymbol{x}_{i_s}\). The corresponding \(p \times 1\) vector of fixed effect parameters relating to the \(r\)th response are denoted by \(\boldsymbol{\beta}_{r}\), which has an assumed multivariate Gaussian prior with mean \(\boldsymbol{0}\) and diagonal covariance matrix \(\alpha\boldsymbol{I}\) that can be chosen by the user. A conjugate Inverse-Gamma prior is specified for \(\sigma_{er}^{2}\), and the corresponding hyperparamaterers (\(\alpha_{3}\), \(\xi_{3}\)) can be chosen by the user.
The \(R \times 1\) vector of random effects for the \(j\)th alter is denoted by \(\boldsymbol{u}_{j} = (u_{j1}, \ldots, u_{jR})_{R \times 1}\), while the \(R \times 1\) vector of isolation effects for all \(R\) outcomes is denoted by \(\boldsymbol{u}^{*} = (u_{1}^*,\ldots, u_{R}^*)\), and both are assigned multivariate Gaussian prior distributions. The unstructured covariance matrix \(\boldsymbol{\Sigma}_{\boldsymbol{u}}\) captures the covariance between the \(R\) outcomes at the network level, and a conjugate Inverse-Wishart prior is specified for this covariance matrix \(\boldsymbol{\Sigma}_{\boldsymbol{u}}\). The corresponding hyperparamaterers (\(\xi_{\boldsymbol{u}}\), \(\boldsymbol{\Omega}_{\boldsymbol{u}}\)) can be chosen by the user.
The exact specification of each of the likelihoods (binomial, Gaussian, and Poisson) are given below:
$$\textrm{Binomial:} ~ Y_{i_sr} \sim \textrm{Binomial}(n_{i_sr}, \theta_{i_sr}) ~ \textrm{and} ~ g(\mu_{i_sr}) = \textrm{ln}(\theta_{i_sr} / (1 - \theta_{i_sr})),$$ $$\textrm{Gaussian:} ~ Y_{i_sr} \sim \textrm{N}(\mu_{i_sr}, \sigma_{er}^{2}) ~ \textrm{and} ~ g(\mu_{i_sr}) = \mu_{i_sr},$$ $$\textrm{Poisson:} ~ Y_{i_sr} \sim \textrm{Poisson}(\mu_{i_sr}) ~ \textrm{and} ~ g(\mu_{i_sr}) = \textrm{ln}(\mu_{i_sr}).$$
multiNet(formula, data, trials, family, W, numberOfSamples = 10, burnin = 0,
thin = 1, seed = 1, trueBeta = NULL, trueURandomEffects = NULL,
trueVarianceCovarianceU = NULL, trueSigmaSquaredE = NULL,
covarianceBetaPrior = 10^5, xi, omega, a3 = 0.001, b3 = 0.001,
centerURandomEffects = TRUE)
The matched call.
The response used.
The design matrix used.
The standardized design matrix used.
The network matrix used.
The matrix of simulated samples from the posterior distribution of each parameter in the model (excluding random effects).
The matrix of simulated samples from the posterior distribution of \(\boldsymbol{\beta}_{1}, \ldots, \boldsymbol{\beta}_{R}\) parameters in the model.
The matrix of simulated samples from the posterior distribution of \(\boldsymbol{\Sigma}_{\boldsymbol{u}}\) in the model.
The matrix of simulated samples from the posterior distribution of network random effects \(\boldsymbol{u}_{1}, \ldots, \boldsymbol{u}_{J}, \boldsymbol{u}^{*}\) in the model.
The vector of simulated samples from the posterior distribution of \(\sigma_{e1}^{2}\), \(\ldots\), \(\sigma_{eR}^{2}\) in the model. Only used if \(\texttt{family}\)=``gaussian".
The acceptance rates of parameters in the model from the MCMC sampling scheme .
The acceptance rates of network random effects in the model from the MCMC sampling scheme.
The time taken for the model to run.
The number of MCMC samples to discard as the burn-in period.
The value by which to thin \(\texttt{numberOfSamples}\).
DBar for the model.
The posterior deviance for the model.
The posterior log likelihood for the model.
The number of effective parameters in the model.
The DIC for the model.
A formula for the covariate part of the model using a similar syntax to that used in the lm() function.
An optional data.frame containing the variables in the formula.
A vector the same length as the response containing the total number of trials \(n_{i_sr}\). Only used if \(\texttt{family}\)=``binomial".
The data likelihood model that must be ``gaussian", ``poisson" or ``binomial".
A matrix \(\boldsymbol{W}\) that encodes the social network structure and whose rows sum to 1.
The number of samples to generate pre-thin.
The number of MCMC samples to discard as the burn-in period.
The value by which to thin \(\texttt{numberOfSamples}\).
A seed for the MCMC algorithm.
If available, the true value of \(\boldsymbol{\beta}_{1}, \ldots, \boldsymbol{\beta}_{R}\).
If available, the true values of \(\boldsymbol{u}_{1}, \ldots, \boldsymbol{u}_{J}, \boldsymbol{u}^{*}\).
If available, the true value of \(\boldsymbol{\Sigma}_{\boldsymbol{u}}\).
If available, the true value of \(\sigma_{e1}^{2}\), \(\ldots\), \(\sigma_{eR}^{2}\). Only used if \(\texttt{family}\)=``gaussian".
A scalar prior \(\alpha\) for the covariance parameter of the beta prior, such that the covariance is \(\alpha\boldsymbol{I}\).
The degrees of freedom parameter for the Inverse-Wishart distribution relating to the network random effects \(\xi_{\boldsymbol{u}}\).
The scale parameter for the Inverse-Wishart distribution relating to the network random effects \(\boldsymbol{\Omega}_{\boldsymbol{u}}\).
The shape parameter for the Inverse-Gamma distribution relating to the error terms \(\alpha_{3}\). Only used if \(\texttt{family}\)=``gaussian".
The scale parameter for the Inverse-Gamma distribution relating to the error terms \(\xi_{3}\). Only used if \(\texttt{family}\)=``gaussian".
A choice to center the network random effects after each iteration of the MCMC sampler.
George Gerogiannis