prevR (version 3.3)

kde,prevR-method: Kernel density estimation for prevR object.

Description

This function allows to calculate a prevalence surface (ratio of two intensity surfaces) and/or a relative risks surface (ratio of two density surfaces) using gaussian kernel estimators with adaptative bandwiths of equal number of observations or equal radius.

Usage

# S4 method for prevR
kde(object, N = NULL, R = NULL, weighted = TRUE,
  risk.ratio = FALSE, keep.details = FALSE, nb.cells = 100,
  cell.size = NULL, progression = TRUE, short.names = FALSE)

Arguments

object

object of class prevR.

N

integer or list of integers corresponding to the rings to use.

R

integer or list of integers corresponding to the rings to use.

weighted

use weighted data (TRUE, FALSE or "2")?

risk.ratio

calculate a relative risks surface instead of a prevalence surface (TRUE, FALSE or "2")?

keep.details

return surface of positive cases and surface of observed cases?

nb.cells

number of cells on the longuest side of the studied area (unused if cell.size is defined).

cell.size

size of each cell (in the unit of the projection).

progression

show a progress bar?

short.names

should names of the output be short?

Value

Object of class SpatialPixelsDataFrame. Surfaces are named according to the name of the corresponding variable, N and R (for example: k.prev.N300.RInf). If short.names is TRUE and if there is only one combination of couples (N, R), variable names will not be suffixed by the value of N and R.

Estimated variables are (depending on the function parameters) :

  • "k.pos" unweighted intensity surface of positive cases.

  • "k.obs" unweighted intensity surface of observed cases.

  • "k.prev" unweighted surface of prevalence (k.pos/k.obs).

  • "k.case" unweighted density surface of positive cases.

  • "k.control" unweighted density surface of observed cases.

  • "k.rr" unweighted surface of relative risks (k.case/k.control).

  • "k.wpos" weighted intensity surface of positive cases.

  • "k.wobs" weighted intensity surface of observed cases.

  • "k.wprev" weighted surface of prevalence (k.wpos/k.wobs).

  • "k.wcase" weighted density surface of positive cases.

  • "k.wcontrol" weighted density surface of observed cases.

  • "k.wrr" weighted surface of relative risks (k.wcase/k.wcontrol).

NA value is applied to cells of the grid located outside of the studied area (see NA.outside.SpatialPolygons).

Details

This function calculates a prevalence surface as the ratio of the intensity surface (expressed in cases per surface unit) of positive cases on the intensity surface of observed cases and could also calculate a relative risks surface corresponding to the ratio of the density surface (whose integral has been normalized to one) of positive cas on density surface of observed cases.

This method is a variant of the nearest neighbour technique. Surfaces are estimated using gaussian kernel estimators with adaptative bandwiths, bandwith size being determined by a minimum number of observations in the neighbourhood (see rings for more details). Fixed bandwiths could also be used. More precisely, the bandwith used is half the radius of rings of equal number of observations or equal radius (parameters N and R) calculated by the function rings. See referenes for a detailed explanation of the implemented methodology.

N and R determine the rings to use for the estimation. If they are not defined, surfaces will be estimated for each available couples (N,R). Several estimations could be simultaneously calculated if several values of N and R are defined.

A suggested value of N could be computed with Noptim.

References

Larmarange Joseph, Vallo Roselyne, Yaro Seydou, Msellati Philippe and Meda Nicolas (2011) "Methods for mapping regional trends of HIV prevalence from Demographic and Health Surveys (DHS)", Cybergeo: European Journal of Geography, no 558, http://cybergeo.revues.org/24606, DOI: 10.4000/cybergeo.24606.

See Also

KernSur{GenKern}, rings,prevR-method, Noptim.

Examples

Run this code
# NOT RUN {
  dhs <- rings(fdhs, N=c(100,200,300,400,500))
  
  prev.N300 <- kde(dhs, N=300, nb.cells=200)
  spplot(prev.N300, 'k.wprev.N300.RInf',
         cuts=100, col.regions=prevR.colors.red(101),
         main="Regional trends of prevalence (N=300)"
  )
  
  prev.krige <- kde(dhs, N=c(100,300,500), R=Inf,
                    nb.cells=200, risk.ratio=2, keep.details=FALSE
  )
  str(prev.krige)
  dev.new()
  spplot(prev.krige,
         c('k.wprev.N100.RInf','k.wprev.N300.RInf','k.wprev.N500.RInf'),
         cuts=100, col.regions=prevR.colors.red(101)
  )
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab