rrstmix {spagmix} | R Documentation |
Spatiotemporal relative risk surface generation
Description
Generates an appropriately scaled spatiotemporal (trivariate) relative risk surface using a supplied control density and N
Gaussian-style hotspots.
Usage
rrstmix(g, rhotspots, rsds, rweights, rbase = 1, log = TRUE,
tlim = NULL, tres = NULL)
Arguments
g |
The control density as a |
rhotspots |
A |
rsds |
A |
rweights |
A vector of length |
rbase |
The base level of the relative risk surface (default is 1). The peaks and troughs will be added or subtracted from this base level prior to normalisation. |
log |
A logical value. If |
tlim |
Only used if |
tres |
Only used if |
Details
This function is the spatiotemporal (trivariate) equivalent of rrmix
. See ‘Details’ in the documentation for that function for more information.
Value
An oject of class rrstim
. This is a list with the following components:
f |
An object of class |
g |
A copy of the object passed to the argument |
r |
An object of class |
Author(s)
A.K. Redmond and 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.
Examples
# time-varying control density
gg1 <- stgmix(mean=matrix(c(2,1,3,0,-1,5),nrow=3),
vcv=array(c(1,0,0,0,1,0,0,0,1,2,0,0,0,1,0,0,0,2),dim=c(3,3,2)),
window=shp2,tlim=c(0,6))
rsk1 <- rrstmix(g=gg1,rhotspots=matrix(c(-2,0,2,1,2,5.5),nrow=3),
rsds=sqrt(cbind(rep(1.5,3),rep(0.25,3))),rweights=c(-0.5,5))
plot(rsk1$g,sleep=0.1,fix.range=TRUE)
plot(rsk1$f,sleep=0.1,fix.range=TRUE)
plot(rsk1$r,sleep=0.1,fix.range=TRUE)
# time-constant control density
set.seed(321)
gg2 <- rgmix(7,window=shp2)
rsk2 <- rrstmix(g=gg2,rhotspots=matrix(c(-1,-1,2,2.5,0,5),nrow=3),
rsds=sqrt(cbind(rep(0.75,3),c(0.05,0.01,0.5))),
rweights=c(-0.4,7),tlim=c(0,6),tres=64)
plot(rsk2$g,sleep=0.1,fix.range=TRUE)
plot(rsk2$f,sleep=0.1,fix.range=TRUE)
plot(rsk2$r,sleep=0.1,fix.range=TRUE)