prevR-class: Objects of class prevR.

prevR-classR Documentation

Objects of class prevR.

Description

Class used by the package prevR

Slots

clusters

data.frame with observed data (one line per cluster). Columns names are:

  • "id" cluster ID.

  • "x" longitude.

  • "y" latitude.

  • "n" number of valid observations per cluster.

  • "pos" number of positive cases per cluster.

  • "prev" observed prevalence (in %) in the cluster (pos/n).

  • "wn" (optional) sum of weights of observations per cluster.

  • "wpos" (optional) sum of weights of positive cases per cluster.

  • "wprev" (optional) weighted observed prevalence (in %) in the cluster (wpos/wn).

  • "c.type" (optional) cluster type.

boundary

object of class sf::sf, borders of the studied area.

proj

object of class sf::crs, map projection used.

rings

list of results returned by rings(). Each entry is composed of 3 elements: N, minimum number of observations per ring; R, maximum radius of rings and estimates, a data frame with the following variables:

  • "id" cluster ID.

  • "r.pos" number of positive cases inside the ring.

  • "r.n" number of valid observations inside the ring.

  • "r.prev" observed prevalence (in \

  • "r.radius" ring radius (in kilometers if coordinates in decimal degrees, in the unit of the projection otherwise).

  • "r.clusters" number of clusters located inside the ring.

  • "r.wpos" (optional) sum of weights of positive cases inside the ring.

  • "r.wn" (optional) sum of weights of valid observations inside the ring.

  • "r.wprev" (optional) weighted observed prevalence (in %) inside the ring (r.wpos/r.wn).

Note: the list rings is named, the name of each element is NN_value.RR_value, for example N300.RInf.

Objects from the Class

Objects of this class could be created by the function as.prevR().

Methods

as.data.frame

signature(x = "prevR") converts an object of class prevR into a data frame.

as.SpatialGrid

signature(object = "prevR") generates a spatial grid.

export

signature(object = "prevR") exports a prevR object as a shapefile, a dbase file or a text file.

idw

signature(formula = "ANY", locations = "prevR") calculates a spatial interpolation using an inverse distance weighting.

kde

signature(object = "prevR") estimates a prevalence surface using kernel density estimators.

krige

signature(formula = "ANY", locations = "prevR") calculates a spatial interpolation by kriging.

plot

signature(x = "prevR", y = "ANY") plots data of a prevR object.

print

signature(x = "prevR") shows a summary of a prevR object.

rings

signature(object = "prevR") calculates rings of equal number of observations and/or equal radius.

show

signature(object = "prevR") shows a summary of a prevR object.

summary

signature(object = "prevR") shows a summary of the variables of a prevR object.

changeproj

signature(object = "prevR") changes the map projection used.

See Also

as.prevR(), is.prevR(), changeproj(), rings(), print(), plot(), summary(), kde(), krige(), idw(), export().

Examples

showClass("prevR")

col <- c(
  id = "cluster",
  x = "x",
  y = "y",
  n = "n",
  pos = "pos",
  c.type = "residence",
  wn = "weighted.n",
  wpos = "weighted.pos"
)
dhs <- as.prevR(fdhs.clusters, col, fdhs.boundary)
str(dhs)
print(dhs)

## Not run: 
dhs <- rings(fdhs, N = c(100, 300, 500))
str(dhs)
print(dhs)

## End(Not run)

prevR documentation built on May 31, 2023, 7:32 p.m.