semipar.eCAR.Leroux  R Documentation 
semipar.eCAR.Leroux
is the main function used to fit the semiparametric Leroux CAR model specified in the spectral domain. This function calls 'INLA'.
semipar.eCAR.Leroux(y, x, W,
E,
C=NULL,
names.covariates=NULL,
model="Gaussian",
L=10,
pcprior.sd=c(0.1,1),
s2=10,
method = "spectral",
num.threads.inla = NULL,
verbose=FALSE, ...)
y 
response vector 
x 
covariate vector for which casual effect is desired 
W 
neighborhood matrix comprised of zeros and ones 
E 
Offset value whose specification depends on the data model selected such that for * 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 
names.covariates 
Specifies the names of the covariates inside C 
model 
Specifies the likelihood or data model. Options are "Gaussian", "Poisson", "Binomial", "Negative Binomial" 
L 
Number of basis functions for the spline model on the (spatial scale)varying beta. The smoothing method applied here is a Bayesian version of the Pspline approach by Eilers and Marx (1996), assuming a random walk on the spline coefficients and a PCprior on the precision parameter of the random walk. 
pcprior.sd 
Vector of length 2 specifying the scaling parameters for the PCpriors assumed on the precision of the (spatial scale)varying beta and the data y, respectively. Each of the scaling parameters can be interpreted as a guess on the marginal standard deviation (default are 0.1 and 1). 
s2 
Prior variance for the log of the dispersion parameter (only used for model="Negative Binomial", default equal to 10). 
method 
A character defining the type of adjustment; either "spectral" (default choice) which implements the model assuming (spatial scale)varying beta, or "naive" which implements the standard method with constant beta hence no spectral adjustment. 
verbose 
logical; if TRUE the verbose output from the "inla" call is printed. 
num.threads.inla 
Argument that indicates the number of computing cores that the INLA call will occupy. For syntax, see “inla.setOption" 
... 
Arguments to be passed to the "inla" call; for instance control.inla=list(strategy="laplace") 
A eCAR object which is a list containing 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

DIC 
Deviance information criterion computed by 'INLA' 
regrcoef 
posterior summaries (mean, sd, 0.025quant, 0.975quant) for the regression coefs associated to the covariates inside 'C' (if model is Binomial, Poisson or Negative binomial, the posterior summaries refer to the exponentiated coef) 
Guan, Y; Page, G.L.; Reich, B.J.; Ventrucci, M.; Yang, S; "A spectral adjustment for spatial confounding" <arXiv:2012.11767>
# Our Rpackage
library(eCAR)
data(lipcancer)
W < lipcancer$neighborhood.Matrix
Y < lipcancer$data$observed
X < lipcancer$data$pcaff
E < lipcancer$data$expected
# only run example if INLA is installed.
if (requireNamespace("INLA", quietly = TRUE)) {
fit1 = semipar.eCAR.Leroux(y=Y, x=X, W=W, E=E, C=NULL,
pcprior.sd = c(0.1,1),
model="Poisson",
L=10,
num.threads.inla = '1:1',
verbose=FALSE)
plot(fit1)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.