par.eCAR.Leroux {eCAR}R Documentation

R wrapper that accesses C code to fit parametric Leroux CAR spatial regression model that accounts for spatial confounding

Description

par.eCAR.Leroux is the main function used to fit the parametric Leroux CAR model specified in the spectral domain.

Usage

par.eCAR.Leroux(y, x, W,
                E=NULL,
                C=NULL,
                model="Gaussian",
                joint_prior_lamx_lamz = FALSE,
                lamx.fix.val = NULL,
                sig2x.fix.val = NULL,
                mb=0,s2b=10,
                mg=0,s2g=10.0,
                alamx=1, blamx=1,
                alamz=1, blamz=1,
                asig=1, bsig=1,
                atau=1, btau=1,
                asigx=1, bsigx=1,
                mb0=0,s2b0=100,
                me=0,s2e=100,
                mx=0,s2x=100,
                tau_cand_sd = 1,
                sig2_cand_sd = 1,
                draws=10000, burn=5000, thin=5,
                verbose=TRUE)

Arguments

y

response vector

x

covariate vector for which casual effect is desired

W

neighborhood matrix comprised of zeros and ones

E

This argument is ignored if model is Gaussian. For other models it takes on the following:

  • Poisson - E is vector that contains expected counts

  • Binomial - E is vector that contains number of trials

  • Negative Binomial - E is vector that contains an offset.

C

design matrix for the covariates that are included as controls

model

Specifies the likelihood or data model. Options are "Gaussian", "Poisson", "Binomial", "Negative Binomial"

joint_prior_lamx_lamz

Logical. If TRUE, then a uniform prior on space such that lamz > lamx. If FALSE, independent beta priors are used.

lamx.fix.val

If a value is supplied then lambda_x is not updated in the MCMC algorithm, but rather treated as the fixed known supplied value

sig2x.fix.val

If a value is supplied then sigma2_x is not updated in the MCMC algorithm, but rather treated as the fixed known supplied value

mb

prior mean for beta. default is 0.

s2b

prior variance for beta. default is 10

mg

prior mean for gamma, where gamma = rho*(sigz/sigx). default is 0.

s2g

prior variance for, gamma), where gamma = rho*(sigz/sigx). default is 10

alamx

prior shape1 parameter for lam.x, default is 1. Only used if joint_prior_lamx_lamz = FALSE

blamx

prior shape2 parameter for lam.x, default is 1. Only used if joint_prior_lamx_lamz = FALSE

alamz

prior shape1 parameter for lam.z, default is 1. Only used if joint_prior_lamx_lamz = FALSE

blamz

prior shape2 parameter for lam.z, default is 1. Only used if joint_prior_lamx_lamz = FALSE

asig

prior shape parameter for sigma2, default is 1. Only used if model is Gaussian

bsig

prior scale parameter for sigma2, default is 1. Only used if model is Gaussian

atau

prior shape parameter for tau, where tau = sigma2.z*(1-rho^2). default is 1

btau

prior scale parameter for tau, where tau = sigma2.z*(1-rho^2). default is 1

asigx

prior shape parameter for sigma2.x, default is 1

bsigx

prior scale parameter for sigma2.x, default is 1

mb0

prior mean parameter for beta0, default is 0. Only used if model is not Gaussian

s2b0

prior variance parameter for beta0, default is 100. Only used if model is not Gaussian

me

prior mean parameter for eta, default is 0. Only used if C is not NULL

s2e

prior variance parameter for eta, default is 100. Only used if C is not NULL

mx

prior mean parameter for xi, default is 0. Only used for negative binomial model

s2x

prior variance parameter for eta, default is 100. Only used for negative binomial model

tau_cand_sd

standard deviation for candidate density in Metropolis step for tau. Default is 1

sig2_cand_sd

standard deviation for candidate density in Metropolis step for sig2. Default is 1. Only used if model is Gaussian

draws

number of MCMC iterates to be collected. default is 10000

burn

number of MCMC iterates discared as burn-in. default is 5000

thin

number by which the MCMC chain is thinned. default is 5

verbose

If TRUE, then details associated with data being fit are printed to screen along with MCMC iterate counter

Value

The function returns an eCAR object which is a list that contains the following

data_model

Character indicating which model was fit

beta_omega

Matrix that contains respectively, the posterior mean lower and upper quantiles of the (spatial scale)-varying beta at each omega value (for the non Gaussian cases it is the exponentiated beta).

posterior_draws

List containing posterior draws of the following parameters

  1. beta: vector containing draws from the posterior distribution of exposure coefficient

  2. gamma: vector containing draws from the posterior distribution of gamma=rho*(sigz/sigx)

  3. tau: vector containing draws from tau=sigma2.z*(1-rho^2)

  4. sig2x: vector containing draws from sig2x

  5. lamx: vector containing draws from the posterior distribution of lamx

  6. lamz: vector containing draws from the posterior distribution of lamz

  7. sigma2: vector containing draws from the posterior distribution of sigma2. Only available if model is Gaussian

  8. rho: vector containing draws from the posterior distribution of rho

  9. sig2z: vector containing draws from the posterior distribution of sig2z

  10. theta: matrix containing draws from the posterior distribution of theta. Only available if model is not Gaussian

  11. beta0: vector containing draws from the posterior distribution of beta0. Only available if model is not Gaussian

  12. eta: matrix containing draws from the posterior distribution of eta, regression coefficients of additional confouner variables. Only available if C is not NULL

  13. nb_r: matrix containing draws from the posterior distribution of nb_r. 0nly available if model is Negative Binomial

DIC

Not available from parametric model yet

regrcoef

Not available from parametric model yet

References

Guan, Y; Page, G.L.; Reich, B.J.; Ventrucci, M.; Yang, S; "A spectral adjustment for spatial confounding" <arXiv:2012.11767>

Examples


# Our R-package
library(eCAR)

data(lipcancer)


W <- lipcancer$neighborhood.Matrix
M <- diag(apply(W,1,sum))
R <- M-W
e.dec <- eigen(R)
e.val <- e.dec$values
D.eigval = diag(e.val)


Y <- lipcancer$data$observed
X <- lipcancer$data$pcaff
E <- lipcancer$data$expected

set.seed(101)
fit1 <- par.eCAR.Leroux(y=Y, x=X, W=W, E=E, C=NULL, model="Poisson",
                         draws=10000, burn=5000, thin=1, verbose=FALSE,
                         joint_prior_lamx_lamz=FALSE)


plot(fit1)

[Package eCAR version 0.1.2 Index]