Learn R Programming

bayesLopod (version 1.0.1)

lopodRaster: Crate raster object for a parameter estimated in a LopodModel

Description

Crate raster object for a parameter estimated in a LopodModel

Usage

lopodRaster(LopodModel, param, extrapolate = T, metric = NULL,
  quant = 0.5)

Arguments

LopodModel

A LopodModel object

param

Unit-level model parameter to be mapped. Values "psi_Sampled" can be mapped for models without CAR analyses, "psi_i" for LopodModels with CAR analysis and "pp","cellpres_i", "pCorr","sim_y","sim_true_y","sim_false_y" for both.

extrapolate

Boolean. If True, parameters are mapped for cells that have not been sampled, this can only be done in LopodModels with CAR analysis. Only plotted for "psi_i", "pp" and, "cellpres_i".

metric

"mean" or "sd". Plots the mean or standard deviation of the posterior distribution. If NULL, the value in quant is used.

quant

Returns the raster for a given quantile of the posterior distribution. Default is 0.5 (the median of the posterior distribution). Not used if metric is other than NULL

Value

A Raster object.

Examples

Run this code
# NOT RUN {
data("simSpRecords", package = "bayesLopod")
data("simSpSamplingEffort", package = "bayesLopod")
simSpRasters = xyToRaster(xyRecords = simSpRecords,xySamplingEffort = simSpSamplingEffort,
basemap = NULL, nrows = 50, extentExpansion = 0)
ld_Raster_adMatrix = rasterLopodData(rasterN = simSpRasters[["samplingEffort"]],
rasterY = simSpRasters[["spDetections"]], Adjacency = TRUE )
mLopodRaster = modelLopod(LopodData = ld_Raster_adMatrix, varP = TRUE, q = NULL,
pmin = 0.1, CAR = FALSE, nChains = 4,warmup = 500,sampling = 100,nCores = 4)

psiRaster = lopodRaster(mLopodRaster, param = "psi_i", extrapolate = TRUE, quant = 0.5)
ppRaster = lopodRaster(mLopodRaster, param = "pp", extrapolate = FALSE, metric = "mean")

Visualize results
sp::spplot(psiRaster)
sp::spplot(ppRaster)
# }

Run the code above in your browser using DataLab