spatstat.univar-package | R Documentation |
The spatstat.univar package belongs to the spatstat family of packages. It provides utilities for estimating the probability distribution of one-dimensional (real-valued) data.
This package is a member of the spatstat family of packages. It provides utilities for estimation of the probability distribution of one-dimensional (i.e. numerical, real-valued) data. The utilities include:
including variable-bandwidth kernels, boundary correction, bandwidth selection, unnormalised weighted densities, and cumulative distribution functions of density estimates.
including weighted empirical cumulative distributions, weighted median, weighted quantiles, calculating the CDF from a density estimate
including Kaplan-Meier, reduced-sample and other estimators of the cumulative distribution function and hazard function from right-censored data
including calculation of quantiles from an empirical cumulative distribution or a kernel density estimate
including calculation of the probability density, cumulative distribution function, quantiles, random generation, moments and partial moments of the standard smoothing kernels
calculation of the one-dimensional heat kernel in an interval
Numerical integration including Stieltjes integrals and indefinite integrals.
The facilities are described in more detail below.
Kernel density estimation
The package supports fixed-bandwidth and variable-bandwidth kernel estimation of probability densities from numerical data. It provides boundary corrections for kernel estimates of densities on the positive half-line (applicable when the original observations are positive numbers) for both fixed-bandwidth and variable-bandwidth estimates.
If the observations have numerical weights associated with them,
these weights will not be automatically normalised, and indeed
the weights may be negative or zero. This is
unlike the standard R method density.default
.
The main functions are:
unnormdensity
|
extension of density.default
allowing weights to be negative or zero.
|
densityBC
| fixed-bandwidth kernel estimate with optional boundary correction |
densityAdaptiveKernel
| adaptive (variable-bandwidth) kernel estimation (generic) |
densityAdaptiveKernel.default
| adaptive (variable-bandwidth) kernel estimate (method for numeric data, with optional boundary correction) |
bw.abram.default
| calculate data-dependent bandwidths using Abramson rule |
CDF.density | cumulative distribution function from kernel density estimate |
Weighted distributions and weighted statistics
Weighted versions of standard operations such as the histogram and empirical distribution function are provided:
whist | weighted histogram |
ewcdf | weighted empirical cumulative distribution function |
mean.ewcdf | mean of weighted ecdf |
quantile.ewcdf | quantiles of weighted ecdf |
knots.ewcdf | jump points of weighted ecdf |
weighted.median | weighted median of numeric values |
weighted.quantile | weighted quantile of numeric values |
Estimation for right-censored data
Facilities are provided for estimating the probability distribution of right-censored lifetimes (non-negative real random variables).
kaplan.meier | Kaplan-Meier estimator of cumulative distribution function and hazard rate, from right-censored data |
reduced.sample | reduced-sample estimator of cumulative distribution function, from right-censored data |
Quantiles
Facilities are provided for computing the quantiles of a probability distribution, given estimates of the probability density or the cumulative distribution function and so on.
CDF.density | cumulative distribution function from kernel density estimate |
quantile.density | quantiles of kernel density estimate |
quantile.ewcdf | quantiles of weighted ecdf |
quantilefun | quantiles as a function |
quantilefun.ewcdf | quantiles as a function |
weighted.quantile | weighted quantile of numeric values |
transformquantiles | transform the quantiles of a dataset |
Kernels
The standard R function density.default
recognises a list of smoothing kernels by name:
"gaussian"
, "rectangular"
, "triangular"
,
"epanechnikov"
, "biweight"
, "cosine"
and "optcosine"
. For these kernels, spatstat.univar
provides various characteristics:
dkernel
| probability density of the kernel |
pkernel
| cumulative distribution function of the kernel |
qkernel
| quantiles of the kernel |
rkernel
| generate simulated realisations from the kernel |
kernel.factor
| scale factor relating bandwidth to half-width of kernel |
kernel.moment
| partial moment of kernel |
kernel.squint
| integral of squared kernel |
dkernelBC
| evaluate the kernel with boundary correction |
Heat kernels
The heat kernel in an interval can be calculated.
hotrod
| calculate the heat kernel in an interval |
Integration
A few facilities are provided for calculating integrals of real functions.
indefinteg | indefinite integral |
integral.density | integral of a kernel density estimate |
stieltjes | Stieltjes integral |
Utilities
A few utilities for numerical data are also provided.
uniquemap.default | map duplicates to unique entries |
rounding.default | determine whether values have been rounded |
firstdigit | leading digit in decimal representation |
lastdigit | least significant digit in decimal representation |
ndigits | number of digits in decimal representation |
This library and its documentation are usable under the terms of the "GNU General Public License", a copy of which is distributed with the package.
, \tilman, \martinH, \ege, \rolf and Greg McSwiggan.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.