Fit a Restricted Shared Component model for two diseases

rscm(data, formula1, formula2, family = c("poisson", "poisson"),
            E1 = NULL, E2 = NULL, area = NULL, neigh = NULL,
            proj = "none", nsamp = 1000,
            priors = list(prior_gamma = c(0, 0.35),
                          prior_prec = list(tau_s = c(0.01, 0.01),
                                            tau_1 = c(0.01, 0.01),
                                            tau_2 = c(0.01, 0.01))),
            random_effects = list(shared = TRUE,
                                  specific_1 = TRUE,
                                  specific_2 = TRUE),
            ...)

Arguments

data

a data frame or list containing the variables in the model.

formula1

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted for disease 1.

formula2

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted for disease 2.

family

a vector of size two with two families. Some allowed families are: poisson, nbinomial, zeroinflatedpoisson0, zeroinflatednbinomial0. See INLA::inla.list.models() for more information.

E1

known component, for disease 1, in the mean for the Poisson likelihoods defined as E = exp(\(\eta\)), where \(\eta\) is the linear predictor. Default = 1.

E2

known component, for disease 2, in the mean for the Poisson likelihoods defined as E = exp(\(\eta\)), where \(\eta\) is the linear predictor. Default = 1.

area

areal variable name in data.

neigh

neighborhood structure. A SpatialPolygonsDataFrame or sf object.

proj

"none" or "spock".

nsamp

number of samples. Default = 1000.

priors

a list containing:

  • prior_gamma: a vector of size two containing mean and precision for the normal distribution applied for \(\gamma\)

  • prior_prec: a list with:

    • tau_s: a vector of size two containing shape and scale for the gamma distribution applied for \(\tau_s\)

    • tau_1: a vector of size two containing shape and scale for the gamma distribution applied for \(\tau_1\)

    • tau_2: a vector of size two containing shape and scale for the gamma distribution applied for \(\tau_2\)

random_effects

a list determining which effects should we include in the model. Default: list(shared = TRUE, specific_1 = TRUE, specific_2 = TRUE).

...

other parameters used in ?INLA::inla

Value

$sample

a sample of size nsamp for all parameters in the model

$summary_fixed

summary measures for the coefficients

$summary_hyperpar

summary measures for hyperparameters

$summary_random

summary measures for random quantities

$out

INLA output

$time

time elapsed for fitting the model

Details

The fitted model is given by $$Y_1 ~ Poisson(E_1\theta_1),$$ $$Y_2 ~ Poisson(E_2\theta_2),$$

$$log(\theta_1) = X\beta + \gamma\psi + \phi_1,$$ $$log(\theta_2) = X\beta + \psi + \phi_2,$$

$$\psi ~ ICAR(\tau_s); \phi_1 ~ ICAR(\tau_1); \phi_2 ~ ICAR(\tau_2).$$

$$\delta = \sqrt\gamma$$

Examples

library(spdep)
#> Loading required package: sp
#> Loading required package: spData
#> To access larger datasets in this package, install the spDataLarge #> package with: `install.packages('spDataLarge', #> repos='https://nowosad.github.io/drat/', type='source')`
#> Loading required package: sf
#> Linking to GEOS 3.6.2, GDAL 2.2.3, PROJ 4.9.3
set.seed(123456) ##-- Spatial structure data("neigh_RJ") ##-- Parameters alpha_1 <- 0.5 alpha_2 <- 0.1 beta_1 <- c(-0.5, -0.2) beta_2 <- c(-0.8, -0.4) tau_s <- 1 tau_1 <- tau_2 <- 10 delta <- 1.5 ##-- Data data <- rshared(alpha_1 = alpha_1, alpha_2 = alpha_2, beta_1 = beta_1, beta_2 = beta_2, delta = delta, tau_1 = tau_1, tau_2 = tau_2, tau_s = tau_s, confounding = "linear", neigh = neigh_RJ) ##-- Models scm_inla <- rscm(data = data, formula1 = Y1 ~ X11 + X12, formula2 = Y2 ~ X21 + X12, family = c("nbinomial", "poisson"), E1 = E1, E2 = E2, area = "reg", neigh = neigh_RJ, priors = list(prior_prec = list(tau_s = c(0.5, 0.05)), prior_gamma = c(0, 0.5)), proj = "none", nsamp = 1000, random_effects = list(shared = TRUE, specific_1 = TRUE, specific_2 = TRUE)) rscm_inla <- rscm(data = data, formula1 = Y1 ~ X11 + X12, formula2 = Y2 ~ X21 + X12, family = c("nbinomial", "poisson"), E1 = E1, E2 = E2, area = "reg", neigh = neigh_RJ, priors = list(prior_prec = list(tau_s = c(0.5, 0.05)), prior_gamma = c(0, 0.5)), proj = "spock", nsamp = 1000, random_effects = list(shared = TRUE, specific_1 = TRUE, specific_2 = TRUE)) ##-- Summary scm_inla$summary_fixed
#> mean median mode sd lower upper #> alpha1 0.454628 0.453513 0.453410 0.066026 0.324790 0.583147 #> alpha2 0.099061 0.097661 0.096875 0.052867 -0.002203 0.202202 #> X11_1 -0.529634 -0.527243 -0.524312 0.094617 -0.725151 -0.360070 #> X12_1 -0.096918 -0.099301 -0.090591 0.712265 -1.437652 1.300094 #> X21_2 -0.821991 -0.821873 -0.825052 0.053160 -0.924361 -0.721452 #> X12_2 -0.315113 -0.308277 -0.308639 0.355988 -0.940467 0.398512
rscm_inla$summary_fixed
#> mean median mode sd lower upper #> alpha1 0.486263 0.488156 0.487102 0.068773 0.353212 0.625193 #> alpha2 0.101960 0.102878 0.102827 0.052721 0.010352 0.210354 #> X11_1 -0.450881 -0.448670 -0.446537 0.092258 -0.653287 -0.288857 #> X12_1 -0.200463 -0.204132 -0.211575 0.166593 -0.516788 0.136881 #> X21_2 -0.819529 -0.820090 -0.821525 0.048604 -0.908102 -0.723579 #> X12_2 -0.294968 -0.295732 -0.295278 0.087644 -0.473432 -0.129857
scm_inla$summary_hyperpar
#> mean median #> size for the nbinomial observations (1/overdispersion) 102.159337 73.338553 #> Precision for psi 1.624693 1.593234 #> Precision for phi1 20.131572 14.180947 #> Precision for phi2 16.421046 15.845955 #> Beta for psi_gamma 2.192927 2.182752 #> Delta 1.479839 1.475757 #> Precision for psi SC 0.739540 0.729550 #> mode sd #> size for the nbinomial observations (1/overdispersion) 52.844186 96.965589 #> Precision for psi 1.567703 0.262432 #> Precision for phi1 10.922866 19.075469 #> Precision for phi2 15.171983 5.720999 #> Beta for psi_gamma 2.174132 0.109452 #> Delta 1.469693 0.035434 #> Precision for psi SC 0.718342 0.104168 #> lower upper #> size for the nbinomial observations (1/overdispersion) 4.585551 285.715222 #> Precision for psi 1.155745 2.159096 #> Precision for phi1 2.143624 55.320532 #> Precision for phi2 6.204610 27.587251 #> Beta for psi_gamma 1.991282 2.414290 #> Delta 1.418131 1.550095 #> Precision for psi SC 0.552672 0.952562
rscm_inla$summary_hyperpar
#> mean median #> size for the nbinomial observations (1/overdispersion) 233.451915 76.311841 #> Precision for psi 0.632703 0.622718 #> Precision for phi1 26.830775 18.309253 #> Precision for phi2 23.987323 19.677618 #> Beta for psi_gamma 2.184501 2.179755 #> Delta 1.477570 1.476902 #> Precision for psi SC 0.289227 0.283742 #> mode sd #> size for the nbinomial observations (1/overdispersion) 33.075785 585.792918 #> Precision for psi 0.613547 0.122101 #> Precision for phi1 11.596291 27.735642 #> Precision for phi2 15.702163 17.051720 #> Beta for psi_gamma 2.176957 0.124036 #> Delta 1.474474 0.042099 #> Precision for psi SC 0.282195 0.051091 #> lower upper #> size for the nbinomial observations (1/overdispersion) 5.276925 898.357883 #> Precision for psi 0.405141 0.875612 #> Precision for phi1 0.435416 79.900368 #> Precision for phi2 2.346459 57.307706 #> Beta for psi_gamma 1.945202 2.430674 #> Delta 1.397345 1.556711 #> Precision for psi SC 0.195223 0.388073