spattemp.risk {sparr}R Documentation

Spatiotemporal relative risk/density ratio

Description

Produces a spatiotemporal relative risk surface based on the ratio of two kernel estimates of spatiotemporal densities.

Usage

spattemp.risk(f, g, log = TRUE, tolerate = FALSE, finiteness = TRUE, verbose = TRUE)

Arguments

f

An object of class stden representing the ‘case’ (numerator) density estimate.

g

Either an object of class stden, or an object of class bivden for the ‘control’ (denominator) density estimate. This object must match the spatial (and temporal, if stden) domain of f completely; see ‘Details’.

log

Logical value indicating whether to return the log relative risk (default) or the raw ratio.

tolerate

Logical value indicating whether to compute and return asymptotic p-value surfaces for elevated risk; see ‘Details’.

finiteness

Logical value indicating whether to internally correct infinite risk (on the log-scale) to the nearest finite value to avoid numerical problems. A small extra computational cost is required.

verbose

Logical value indicating whether to print function progress during execution.

Details

Fernando & Hazelton (2014) generalise the spatial relative risk function (e.g. Kelsall & Diggle, 1995) to the spatiotemporal domain. This is the implementation of their work, yielding the generalised log-relative risk function for x\in W\subset R^2 and t\in T\subset R. It produces

\hat{\rho}(x,t)=\log(\hat{f}(x,t))-\log(\hat{g}(x,t)),

where \hat{f}(x,t) is a fixed-bandwidth kernel estimate of the spatiotemporal density of the cases (argument f) and \hat{g}(x,t) is the same for the controls (argument g).

Value

An object of class “rrst”. This is effectively a list with the following members:

rr

A named (by time-point) list of pixel images corresponding to the joint spatiotemporal relative risk over space at each discretised time.

rr.cond

A named list of pixel images corresponding to the conditional spatial relative risk given each discretised time.

P

A named list of pixel images of the p-value surfaces testing for elevated risk for the joint estimate. If tolerate = FALSE, this will be NULL.

P.cond

As above, for the conditional relative risk surfaces.

f

A copy of the object f used in the initial call.

g

As above, for g.

tlim

A numeric vector of length two giving the temporal bound of the density estimate.

Author(s)

T.M. Davies

References

Fernando, W.T.P.S. and Hazelton, M.L. (2014), Generalizing the spatial relative risk function, Spatial and Spatio-temporal Epidemiology, 8, 1-10.

See Also

spattemp.density, spattemp.slice, bivariate.density

Examples


data(fmd)
fmdcas <- fmd$cases
fmdcon <- fmd$controls

f <- spattemp.density(fmdcas,h=6,lambda=8) # stden object as time-varying case density
g <- bivariate.density(fmdcon,h0=6) # bivden object as time-static control density
rho <- spattemp.risk(f,g,tolerate=TRUE) 
print(rho)

par(mfrow=c(2,3))
plot(rho$f$spatial.z,main="Spatial margin (cases)") # spatial margin of cases
plot(rho$f$temporal.z,main="Temporal margin (cases)") # temporal margin of cases
plot(rho$g$z,main="Spatial margin (controls)") # spatial margin of controls
plot(rho,tselect=50,type="conditional",tol.args=list(levels=c(0.05,0.0001),
     lty=2:1,lwd=1:2),override.par=FALSE)
plot(rho,tselect=100,type="conditional",tol.args=list(levels=c(0.05,0.0001),
     lty=2:1,lwd=1:2),override.par=FALSE)
plot(rho,tselect=200,type="conditional",tol.args=list(levels=c(0.05,0.0001),
     lty=2:1,lwd=1:2),override.par=FALSE)


[Package sparr version 2.3-10 Index]