Bayesian inference for a spatio-temporal LGCP model with or without covariates.
lgcp(
data,
data.t = NULL,
sp.covs = NULL,
t.covs = NULL,
pop.var = NULL,
boundary,
covariates = NULL,
cellwidth,
laglength,
dirname = NULL,
prevRun = NULL,
mala.pars = c(26250, 20000, 50),
nchains = parallel::detectCores(),
lib = NULL
)A data frame consisting of columns x, y, and t, which are two
spatial coordinates and time point respectively.
A data frame containing any temporal covariates with a column t with the
time period and subsequent columns describing the value(s) of the covariates.
A vector with the names of spatially-varying covariate to use in the model
(can be NULL). These must match the column names in covariates.
A vector with the names of temporally-varying covariates (can be NULL).
These names must match the names of columns in data.t.
The name of the population density variable to be used for the population
offset (can be NULL). This must match the name of a column in covariates.
A spatialPolygonsDataFrame of the boundary of the area of interest.
A spatialPolygonsDataFrame covering the area of interest and containing
the covariate and population density data.
The width of cells of the computational grid.
The number of time periods to include. The maximum value of t in data
is used as the present period, and time periods are counted back from this value.
The directory root name to save model output. A directory is created for each
MCMC chain as dirname.1, dirname.2, etc. If NULL then a temporary directory is used,
this will result in the data being lost after the session in closed though.
Used to set prior distributions. Either output from a previous call to lgcp
to use posterior distributions from previous period, or a call to lgcp::lgcpPrior.
Parameters for the MCMC sampler. A vector of three numbers: the total number of iterations, the number of warmup iterations, and the number to thin.
The number of MCMC chains, default is parallel::detectCores()
Library location if not the default, otherwise NULL
An object of class lgcpReal
The lgcp function provides a wrapper to several functions from the lgcp package.
It simplifies the workflow described in the vignette for that package, providing a single
function to generate the appropriate grid, covariate matrices and lists, and perform inference
with the function lgcp::lgcpPredictSpatioTemporalPlusPars. See the vignette for this
package for a description of the model. The implementation here allows for spatially and/or
temporally varying covariates but not spatio-temporally varying covariates, as in the time-scales
relevant to real-time surveillance applications these are not generally available. For users
requiring additional functionality, please refer to the lgcp package documentation.
# NOT RUN {
data(dat,square,square_pop)
lg1 <- lgcp(data=dat,
pop.var = c("popdens"),
boundary=square,
covariates=square_pop,
cellwidth=0.1,
laglength = 7,
mala.pars=c(200,100,1),
nchains=2)
# }
Run the code above in your browser using DataLab