Description Usage Arguments Details Value Examples
The riskEst
function computes the estimations of the relative risk with high raster resolution.
1 2 3 |
cases |
Spatial polygons, data frame or vector of case data |
lemObjects |
List of arrays for the smoothing matrix, and raster stacks for the partition and smoothed offsets |
bw |
Vector of bandwidths specifying which smoothing matrix in |
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 risk estimation |
verbose |
Verbose output |
After using the riskEst
function, the risk estimations are computed on a fine resolution based on the rasterization of the spatial polygons of population data.
The riskEst
function returns a raster brick of risk estimations for the input bandwidths.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | ## 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'
# 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
lemRisk = riskEst(cases = kentuckyCounty[,c('id','count')],
lemObjects = lemSmoothMat,
bw = bw,
ncores = ncores,
path = path,
filename = 'lemRisk.grd',
verbose = TRUE)
# plot risk
rCol = mapmisc::colourScale(lemRisk$riskEst,
breaks = 5, style = 'quantile', dec = 2)
par(mfrow = c(2,2), mar = c(0.5,0.5,3,0.5))
for(inBw in 1:length(bw)) {
plot(lemRisk$riskEst[[inBw]],
main = paste('Risk, bw=', bw[inBw], 'km', sep = ''),
col = rCol$col, breaks = rCol$breaks,
axes = FALSE, box = FALSE, legend = FALSE,
add = FALSE)
}
mapmisc::legendBreaks('right', rCol)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.