riskEst: Computes the relative risk estimation

Description Usage Arguments Details Value Examples

View source: R/lemEstFun.R

Description

The riskEst function computes the estimations of the relative risk with high raster resolution.

Usage

1
2
3
riskEst(cases, lemObjects, bw, fact = 1, ncores = 1,
  iterations = list(tol = 1e-05, maxIter = 1000, gpu = FALSE),
  path = getwd(), filename = "lemRisk.grd", verbose = FALSE)

Arguments

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 lemObjects to use

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

Details

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.

Value

The riskEst function returns a raster brick of risk estimations for the input bandwidths.

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

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

Related to riskEst in localEM...