smoothingMatrix: Generates the smoothing matrix for the partitions and...

Description Usage Arguments Details Value Examples

View source: R/smoothMatFun.R

Description

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.

Usage

1
2
smoothingMatrix(rasterObjects, ncores = 1, path = getwd(),
  filename = "lemSmoothMat.grd", verbose = FALSE)

Arguments

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

Details

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.

Value

The smoothingMatrix function returns a list containing an array of smoothing matrix entries, and the input rasters of partitions and smoothed offsets.

Examples

 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
## 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)

localEM documentation built on May 3, 2019, 1:24 p.m.