Description Usage Arguments Details Value Author(s) References See Also Examples
This function performs spatial continuous and discrete prediction, fixing the model parameters at the Monte Carlo maximum likelihood estimates of a SDALGCP model.
1 2 3 4 5 6 7 8 9 10 11 |
para_est |
an object of class "SDALGCP" obtained as a result of a call to |
cellsize |
the size of the computational grid |
continuous |
logical; to choose which prediction to do perform, discrete or continuous. the default is continuous. |
control.mcmc |
output from |
pred.loc |
optional, the dataframe of the predictive grid. |
divisor |
optional, the value to use to convert the dimension of the polygon, default is 1 which implies no conversion |
plot.correlogram |
logical; if plot.correlogram=TRUE the autocorrelation plot of the conditional simulations is displayed. |
messages |
logical; if messages=TRUE then status messages are printed on the screen (or output device) while the function is running. Default is messages=TRUE. |
parallel |
to parallelize some part of the function. |
The function perform prediction of the spatially discrete incidence and covariate adjusted relative risk, and spatially continuous relative risk. The discrete inference uses the Metropolis-Adjusted Langevin Hasting sampling from Laplace.sampling
. And the continuous inference is typically change of support inference.
pred.draw: the samples of the prediction
pred: the prediction of the relative risk
predSD: the standard error of the prediction
Pred.loc: The coordinates of the predictive locations
Olatunji O. Johnson o.johnson@lancaster.ac.uk
Emanuele Giorgi e.giorgi@lancaster.ac.uk
Peter J. Diggle p.diggle@lancaster.ac.uk
Banerjee, S., Carlin, B. P., & Gelfand, A. E. (2014). Hierarchical modeling and analysis for spatial data. CRC press.
plot.Pred.SDALGCP, SDAContinuousPred, SDADiscretePred, plot_continuous, plot_discrete
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ### Prepare the input of the model
data(PBCshp)
data <- as.data.frame(PBCshp@data) #get the data
### Write the formula of the model
FORM <- X ~ propmale + Income + Employment + Education + Barriers + Crime +
Environment + offset(log(pop))
### set the discretised phi
phi <- seq(500, 1700, length.out = 20)
#### get the initial parameter
model <- glm(formula=FORM, family="poisson", data=data)
beta.start <-coef(model)
sigma2.start <- mean(model$residuals^2)
phi.start <- median(phi)
par0 <- c(beta.start, sigma2.start, phi.start)
# setup the control arguments for the MCMC
n <- 545
h <- 1.65/(n^(1/6))
control.mcmc <- controlmcmcSDA(n.sim = 10000, burnin = 2000,
thin= 8, h=h, c1.h = 0.01, c2.h = 1e-04)
###Run the model
my_est <- SDALGCPMCML(formula=FORM, data=data, my_shp=PBCshp, delta=100, phi=phi, method=1,
weighted=FALSE, plot=TRUE, par0=par0, control.mcmc=control.mcmc)
Con_pred <- SDALGCPPred(para_est=my_est, cellsize=300, continuous=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.