excProb: Computes the exceedance probabilities

Description Usage Arguments Details Value Examples

View source: R/excProbFun.R

Description

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.

Usage

1
2
3
4
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)

Arguments

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

Details

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.

Value

The excProb function returns a raster brick of exceedance probabilities of input risk thresholds.

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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
## 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)

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

Related to excProb in localEM...