A useful tool for the comparison of two estimated density functions on the same spatial region \(W \subset R^2\) is the relative risk function, \(r\), (Bithell, 1990; 1991; Kelsall and Diggle, 1995), defined simply as a density-ratio:
\(r(x) = f(x) / g(x); x \in W.\)
Various methods have been developed to improve estimation of \(r\), most commonly with a motivation in geographical epidemiology, where the `numerator' density \(f\) pertains to the observed disease cases and the `denominator' density \(g\) reflects the distribution of the at-risk controls (Kelsall and Diggle, 1995; Hazelton and Davies, 2009; Davies and Hazelton, 2010). To test newly developed methodology, simulations based on known relative risk scenarios are usually necessary. This function allows the user to design such scenarios, as used in Hazelton and Davies (2009), Davies and Hazelton (2010), and Davies (2013) for example.
This function calculates a relative risk surface based on \(N\) Gaussian-style `bumps' added and subtracted from a base level of rbase, with the peaks and troughs centered at the coordinates given by rhotspots with relative weights of rweights and isotropic standard deviations of rsds. The risk surface \(r\) is computed as
\(r(x) \propto \) rbase \(+ \sum_{i=1}^{N}\) rweights[\(i\)]\(*exp(-0.5*\)rsds[\(i\)]\(^(-2)*\)||\(x-\)rhotspots[,\(i\)]||\(^2)\)
where || . || denotes Euclidean norm. Because \(f\) and \(g\) are both densities, the risk surface as defined above must then be rescaled with respect to the supplied control density \(g\) (argument g) to ensure that
\(\int_W r(x)g(x) dx = 1\)
This is automatically performed inside the function. The case density that gives rise to the designed \(r\) is then easily recovered because \(f = r * g\). By default, the function returns the log-relative risk surface \(\log r = \log f - \log g\) alongside the case and control densities.