excProb {localEM} | R Documentation |
The excProb
function first bootstraps cases with the input risk thresholds and expected counts from the rasterization of the spatial polygons of population data, and then, computes the exceedance probabilities with the same bandwidth as the risk estimation.
excProb(lemObjects, threshold = 1, Nboot = 100, bw, fact = 1, ncores = 1, iterations = list(tol = 1e-05, maxIter = 1000, gpu = FALSE), path = getwd(), filename = "lemExcProb.grd", verbose = FALSE)
lemObjects |
List of arrays for the smoothing matrix, and raster stacks for the partition, smoothed offsets and risk estimation |
threshold |
Vector of risk thresholds |
Nboot |
Number of bootstraps |
bw |
Bandwidth for smoothing bootstrap samples |
fact |
Aggregation factor prior to 'final step' smoothing (set to zero to skip final step) |
ncores |
Number of cores/threads for parallel processing |
iterations |
List of convergence tolerance, number of iterations, and use of gpuR package for running local-EM recursions |
path |
Folder for storing rasters |
filename |
Filename (must have .grd extension) of the exceedance probabilities |
verbose |
Verbose output |
After using the excProb
function, the exceedance probabilities are computed on a fine resolution based on the rasterization of the spatial polygons of population data.
The excProb
function returns a raster brick of exceedance probabilities of input risk thresholds.
## Not run: # case and population data data('kentuckyCounty') data('kentuckyTract') # parameters ncores = 2 cellsCoarse = 8 cellsFine = 100 bw = c(10, 15, 17.5, 20) * 1000 path = 'example' threshold = c(1, 1.1, 1.25, 1.5) Nboot = 100 # rasters of case and population data lemRaster = rasterPartition(polyCoarse = kentuckyCounty, polyFine = kentuckyTract, cellsCoarse = cellsCoarse, cellsFine = cellsFine, bw = bw, ncores = ncores, path = path, idFile = 'lemId.grd', offsetFile = 'lemOffsets.grd', verbose = TRUE) # smoothing matrix lemSmoothMat = smoothingMatrix(rasterObjects = lemRaster, ncores = ncores, path = path, filename = 'lemSmoothMat.grd', verbose = TRUE) # risk estimation for bandwidth of 10km lemRisk = riskEst(cases = kentuckyCounty[,c('id','count')], lemObjects = lemSmoothMat, bw = bw[1], fact = 1, ncores = ncores, path = path, filename = 'lemRisk.grd', verbose = TRUE) # exceedance probabilities for bandwidth of 10km lemExcProb = excProb(lemObjects = lemRisk, threshold = threshold, Nboot = Nboot, bw = bw[1], fact = 1, ncores = ncores, path = path, filename = 'lemExcProb.grd', verbose = TRUE) # plot exceedance probabilities pCol = mapmisc::colourScale(lemExcProb$excProb, breaks = c(0,0.2,0.8,0.95,1), style = 'fixed', dec = 2, col = c('green','yellow','orange','red')) par(mfrow = c(2,2), mar = c(0.5,0.5,3,0.5)) for(inT in 1:length(threshold)) { plot(lemExcProb$excProb[[inT]], main = paste('Exc Prob, t=', threshold[inT], ' (bw=10km)', sep = ''), col = pCol$col, breaks = pCol$breaks, axes = FALSE, box = FALSE, legend = FALSE, add = FALSE) } mapmisc::legendBreaks('topright', pCol) ## End(Not run)