estimate_density: Estimate density

Description Usage Arguments Value Examples

Description

function to estimate 2d density, from data frame output by density_data Produce a 2-d estimated intensity function (cases per unit area) from an (x, y, (corrected) counts) data frame.

Usage

1

Arguments

density_data

A data frame with columns x, y and (corrected) number of individuals, as output by the density_data function.

show.density

Set to TRUE to plot the data and calculated density.

Value

A SpatialGridDataFrame object containing intensity/prevalence estimates (@data$v), at a grid of points (@grid).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
if(require(sp)){
# simulate a line list of patient locations
my.linelist <- data.frame(	longitude = round(runif(100, 0, 10), 0.01),
								latitude = round(runif(100, 0, 10), 0.01)
							)

# transform patients dataframe into spatialpointsdataframe
pointspatients <- SpatialPointsDataFrame(my.linelist, data=data.frame(id=1:100))

my.density.data <- density_data(pointspatients)
my.density.estimate <- estimate_density(my.density.data, show.density=TRUE)

}

Hackout2/mapData documentation built on May 6, 2019, 9:48 p.m.