Spatial and Spatiotemporal Relative Risk

Provides functions to estimate kernel-smoothed spatial and spatio-temporal densities and relative risk functions, and perform subsequent inference. Methodological details can be found in the accompanying tutorial: Davies et al. (2018) .


The sparr package for R provides functions to estimate fixed and adaptive kernel-smoothed spatial relative risk surfaces via the density-ratio method and perform subsequent inference. Fixed-bandwidth spatiotemporal density and relative risk estimation is also supported.

Installation

This package is available on CRAN, and we recommend installing it from there using the standard

install.packages('sparr')

If you wish to live on the bleeding edge, you may install from github using devtools:

devtools::install_github('tilmandavies/sparr')

Example

This is a basic example of relative risk estimation for primary biliary cirrhosis cases from north east England.

# Load library
library(sparr)
#> Loading required package: spatstat
#> Loading required package: spatstat.data
#> Loading required package: nlme
#> Loading required package: rpart
#> 
#> spatstat 1.55-0       (nickname: 'Stunned Mullet') 
#> For an introduction to spatstat, type 'beginner'
#> 
#> 
#> Welcome to
#>    _____ ___  ____  ____  ____         
#>   / ___// _ \/ _  \/ __ \/ __ \        
#>   \__ \/ ___/ __  /  ___/  ___/        
#>  ___/ / /  / / / / /\ \/ /\ \          
#> /____/_/  /_/ /_/_/  \__/  \_\   v2.2-12
#> 
#> - type news(package="sparr") for an overview
#> - type help("sparr") for documentation
#> - type citation("sparr") for how to cite
 
# Load data on cases of primary biliary cirrhosis from north east England
data(pbc)
 
# Split into cases and controls
pbc_case <- split(pbc)$case
pbc_cont <- split(pbc)$control
 
# Estimate global bandwidth for smoothing
h0 <- OS(pbc, nstar="geometric")
 
# Compute a symmetric (pooled) adaptive relative risk estimate
# with tolerance contours
pbc_rr <- risk(pbc_case, pbc_cont, h0=h0, adapt=TRUE, tolerate=TRUE,
               hp=OS(pbc)/2, pilot.symmetry="pooled", davies.baddeley=0.05)
#> Estimating case density...
#> Done.
#> Estimating control density...Done.
#> Calculating tolerance contours...Done.
 
# And produce a plot
plot(pbc_rr)

News

    CHANGES IN sparr VERSION 2.2-13

OVERVIEW

o Changed default of 'hold' argument in 'SLIK.adapt'
o Finer control when plotting 'rrst' objects
o Reference updates

SIGNIFICANT USER-VISIBLE CHANGES

o SLIK.adapt
Argument 'hold' now defaults to 'TRUE'
o plot.rrst
New argument 'expscale' for raw-risk scale on image plots of
log-relative risk surfaces 



    CHANGES IN sparr VERSION 2.2-12

OVERVIEW

o Added 'optim.control' argument to 'SLIK.adapt'
o Added internal maximum bandwidth limit to 'SLIK.adapt'
o Minor bugs squashed, doc updates



    CHANGES IN sparr VERSION 2.2-11

OVERVIEW

o Updated citation information and package description



    CHANGES IN sparr VERSION 2.2-1

OVERVIEW

o New experimental function 'SLIK.adapt' for simultaneous global-pilot bandwidth selection for adaptive densities
o Newly visible function 'rimpoly' for random point generation
o Additional control over small bandwidth action in leave-one-out bandwidth selectors
o Improved edge-correction calculations for brute force adaptive leave-one-out
o Updated citation information and documentation corrections

NEW FUNCTIONS

o rimpoly
Random spatial point generation based on a pixel image, returned with a polygonal window
o SLIK.adapt
Simultaneous bandwidth selector for global and pilot bandwidth for adaptive density estimates based on likelihood cross-validation

SIGNIFICANT USER-VISIBLE CHANGES

o LIK.density, LSCV.density
New argument 'zero.action' to provide greater control over the behaviour of leave-one-out
calculations at very small bandwidths.



    CHANGES IN sparr VERSION 2.1-14

OVERVIEW

o Updated citation information



    CHANGES IN sparr VERSION 2.1-13

OVERVIEW

o Minor documentation link corrections



    CHANGES IN sparr VERSION 2.1-12

OVERVIEW

o Includes 'weights' argument for bivariate.density



    CHANGES IN sparr VERSION 2.1-11

OVERVIEW

o Citation information and NEWS file changes.

    
    
    CHANGES IN sparr VERSION 2.1-10

OVERVIEW

o MAJOR CHANGES since versions <= 0.3-8; NO BACKWARDS COMPATIBILITY

o Accompanying tutorial currently submitted for publication; contact maintainer
  for preprint or see https://arxiv.org/abs/1707.06888

o User is directed to the examples as part of help("sparr") for
  further assistance

NEW FUNCTIONS

o LIK.density, BOOT.density
New functions for bivariate density bandwidth selection.

o multiscale.density, multiscale.slice
Multi-scale adaptive kernel density estimation.

o OS.spattemp, NS.spattemp, LSCV.spattemp, LIK.spattemp, BOOT.spattemp
Bandwidth selection for spatiotemporal bandwidth selection.

o spattemp.density, spattemp.risk, spattemp.slice
Spatiotemporal density and relative risk estimation.

o plot.stden, plot.msden, plot.rrst, tol.contour
New plotting functions.

o burk, fmd
New datasets.

SIGNIFICANT USER-VISIBLE CHANGES

o bivariate.density, risk, tolerance, LSCV.density, LSCV.risk, OS, NS, plot
Usage changed. Speed improvements.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("sparr")

2.2-15 by Tilman M. Davies, a month ago


https://tilmandavies.github.io/sparr/, https://github.com/tilmandavies/sparr/


Report a bug at https://github.com/tilmandavies/sparr/issues/


Browse source code at https://github.com/cran/sparr


Authors: Tilman M. Davies [aut, cre] , Jonathan C. Marshall [aut]


Documentation:   PDF Manual  


Task views: Analysis of Spatial Data


GPL (>= 2) license


Imports spatstat.utils, spatstat.geom, spatstat.core, doParallel, parallel, foreach, misc3d

Depends on spatstat

Suggests fftwtools


Imported by envi, gateR, spagmix, sparrpowR.

Depended on by Kernelheaping.

Suggested by lgcp.


See at CRAN