Description Usage Arguments Details Value Author(s) References Examples
View source: R/createDensity.R
Given a lattice and a point pattern of observations, createDensity starts random walks at each observation. k steps are taken and the output is a densityOut object, which can be used to plot a density estimate. If you wish to perform non-parametric regression, you should use the functions addQuantVar and createNparReg instead.
1 2 3 4 5 6 7 8 | createDensity(
formLatticeOutput,
PointPattern = NULL,
M = 0.5,
k,
intensity = FALSE,
sparse = TRUE
)
|
formLatticeOutput |
An object from formLattice or editLattice. |
PointPattern |
A 2-column matrix or data frame of locations. |
M |
Maximum probability of random walk moving. |
k |
The smoothing parameter (number of steps). |
intensity |
Plot an intensity vs a density. |
sparse |
If TRUE, matrix computations are sparse. |
We start with an initial probability density p0 where the ith entry in p0 is the fraction of the point pattern that is nearest to the ith node. This is the empirical density function with no smoothing. If T is the transition matrix, and given a number of steps in the diffusion, T k p0 is the probability density of the diffusion after k steps. This is the major output of this function, along with information needed to produce a plot, including the polygons for the boundary and holes, and a vector of NS coordinates and EW coordinates used by the contour function. All of the necessary information for plotting is bundled in the object of class densityOutLBDE. Details of this process can be found in Barry and McIntyre (2011).
An object of type densityOut
EW_locs A vector of EW coordinates of nodes.
NS_locs A vector of NS coordinates of nodes.
boundaryPoly The boundary of the region (two-columns).
hole_list A list of polygonal holes in the region.
PointPattern A 2-column matrix of observations.
probs The probability distribution over the nodes.
densityLBDE Density in a form for making a contour map.
area The area of the region, with holes removed.
Ronald P. Barry
Ronald P. Barry, Julie McIntyre. Estimating animal densities and home range in regions with irregular boundaries and holes: A lattice-based alternative to the kernel density estimator. Ecological Modelling 222 (2011) 1666-1672. <doi:10.1080/10618600.2017.1375935>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | plot.new()
data(polygon1)
nodeFillingOutput <- nodeFilling(poly=polygon1, node_spacing=0.02)
plot(nodeFillingOutput)
formLatticeOutput <- formLattice(nodeFillingOutput)
plot(formLatticeOutput)
Pointdata <- splancs::csr(polygon1,75)
Pointdata <- Pointdata[Pointdata[,1]<0.5,]
plot(polygon1,type="n")
polygon(polygon1)
points(Pointdata,pch=19)
out <- crossvalDensity(formLatticeOutput,PointPattern=Pointdata,
M=0.5,max_steps = 35)
densityOut <- createDensity(formLatticeOutput,
PointPattern=Pointdata,
k=out$k,intensity=FALSE, sparse = TRUE)
plot(densityOut)
homerange(densityOut, percent = 0.95)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.