Nothing
#' Inhomogeneous K-function Estimation
#' Estimate the inhomogeneous K function of a non-stationary point pattern.
#' @param pts matrix of the \code{x,y}-coordinates of the point locations.
#' @param lambda intensity function evaluated at the above point locations.
#' @param poly matrix of the \code{x,y}-coordinates of the polygon boundary.
#' @param s vector of distances at which to calculate the K function.
#' @return A list with components
#' \describe{
#' \item{k}{values of estimated K at the distances \code{s}.}
#' \item{s}{copy of \code{s}.}
#' }
#' @details
#' The inhomogeneous K function is a generalization of the usual K
#' function defined for a second-order intensity-reweighted stationary
#' point process, proposed by Baddeley \emph{et\ al} (2000).
#'
#' When the true intensity function is unknown, and is to be estimated
#' from the same data as been used to estimate the K function,
#' a modified kernel density estimation implemented in \code{\link{lambdahat}}
#' with argument \code{gpts=NULL}
#' can be used to calculate the estimated intensity at data points.
#' See Baddeley \emph{et al} (2000) for details,
#' and Diggle, P.J., \emph{et al} (2006) for a cautious note.
#' @note This code is adapted from \pkg{splancs} (Rowlingson and Diggle, 1993)
#' fortran code for the estimation of homogeneous K function
#' \code{\link[splancs]{khat}}, with edge correction inherited
#' for a general polygonal area.
#' @seealso \code{\link[splancs]{khat}}, \code{\link{lambdahat}}
#' @references
#' \enumerate{
#' \item Baddeley, A. J. and M?ller, J. and Waagepetersen R.
#' (2000) Non and semi-parametric estimation of interaction in
#' inhomogeneous point patterns, \emph{Statistica Neerlandica}, \bold{54},
#' 3, 329--350.
#' \item Diggle, P.J., V. G\eqn{\acute{\mathrm{o}}}mez-Rubio,
#' P.E. Brown, A.G. Chetwynd and S. Gooding (2006) Second-order
#' analysis of inhomogeneous spatial point processes using case-control
#' data, \emph{submitted to Biometrics}.
#' \item Rowlingson, B. and Diggle, P. (1993) Splancs: spatial point pattern
#' analysis code in S-Plus. \emph{Computers and Geosciences}, \bold{19},
#' 627--655.
#' }
#' @keywords spatial
#' @export
kinhat <- function (pts, lambda, poly, s)
{
ptsx <- pts[, 1]
ptsy <- pts[, 2]
npt <- length(ptsx)
ns <- length(s)
s <- sort(s)
np <- length(poly[, 1])
polyx <- c(poly[, 1], poly[1, 1])
polyy <- c(poly[, 2], poly[1, 2])
hkhat <- rep(0, times = ns)
klist <- .Fortran("dokinhat", as.double(ptsx), as.double(ptsy),
as.integer(npt), as.double(lambda), as.double(polyx), as.double(polyy),
as.integer(np), as.double(s), as.integer(ns), as.double(hkhat),
PACKAGE="spatialkernel")
res <- list(k = as.numeric(klist[[10]]), s = s)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.