smoothingMatrix {localEM} | R Documentation |
The smoothingMatrix
function computes the entries of the smoothing matrix for the local-EM algorithm for the input bandwidths based on the partitions created by rasterizing the spatial polygons of case and population data, and their smoothed offsets created by applying the kernel smoothing function with input bandwidths.
smoothingMatrix(rasterObjects, ncores = 1, path = getwd(), filename = "lemSmoothMat.grd", verbose = FALSE)
rasterObjects |
Raster stacks for partitions and smoothed offsets |
ncores |
Number of cores/threads for parallel processing |
path |
Folder to store raster data |
filename |
Filename (must have .grd extension) of the entries of smoothing matrix |
verbose |
Verbose output |
After using the smoothingMatrix
function, the smoothing matrix is an array containing the integrated kernel smoothing entries of the partitions divided by the integrated kernel smoothing entries of the study region for each specified bandwidth.
The smoothingMatrix
function returns a list containing an array of smoothing matrix entries, and the input rasters of partitions and smoothed offsets.
## 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 = rasterPartitionSingle(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 = smoothingMatrixSingle(rasterObjects = lemRaster, ncores = ncores, path = path, filename = 'lemSmoothMat.grd', verbose = TRUE) ## End(Not run)