ddd {dwp} | R Documentation |
Calculate Probability Functions for Distance Distributions
Description
Calculate the standard d/p/q/r family of R probability functions for distance
distributions (dd
) as well as the relative carcass
density (rcd
). Usage broadly parallels that of the d/p/q/r probability
functions like dnorm
, pnorm
, qnorm
, and
rnorm
.
Usage
ddd(x, model, parms = NULL, extent = "full", zrad = 200)
pdd(q, model, parms = NULL, extent = "full", zrad = 200, silent = FALSE)
qdd(p, model, parms = NULL, extent = "full", zrad = 200, subdiv = 1000)
rdd(n, model, parms = NULL, extent = "full", zrad = 200, subdiv = 1000)
rcd(x, model, parms = NULL, extent = "full", zrad = 200)
Arguments
x , q , p , n |
numeric, |
model |
either a |
parms |
model parameters; required if model is specified as a character
string rather than a |
extent |
for a full distribution extrapolated beyond the search radius
to account for all carcasses, use |
zrad |
the distance at which carcass density is assumed to be zero; to be used only in simulation reps in which simulated parameters do not yield extensible distributions, essentially returning 0 rather than NA for those pathological cases. |
silent |
If |
subdiv |
if the number of values to calculate with |
Details
The probability density function (PDF(x) = f(x) = ddd(x, ...)
)
gives the probability that a carcass falls in a 1 meter ring centered at the
turbine and with an outer radius of x
meters. The cumulative distribution
function [CDF(x) = F(x) = pdd(x, ...)
] gives the
probability that a carcass falls within x
meters from the turbine. For
a given probability, p
, the inverse CDF [qdd(p,...)
] gives the
p
quantile of carcass distances. For example, qdd(0.5,...)
gives the median carcass distance, and qdd(0.9, ...)
gives the radius
that 90% of the carcasses are expected to fall in. Random carcass distances
can be generated using rdd
.
The relative carcass density function(rcd
) gives relative carcass
densities at a point x
meters from a turbine. In general, rcd is
proportional to PDF(x)/x, normalized so that the surface of rotation of rcd(x)
has total volume of 1. There are more stringent contstraints on the allowable
parameters in the fitted (or simulated) glm's because the integral of PDF(x)/x
must converge.
Distributions may be extrapolated beyond the search radius to account for all
carcasses, including those that land beyond the search radius
(extent = "full"
), or may be restricted to carcasses falling within the
searched area (extent = "win"
). Typically, in estimating dwp
for
a fatality estimator like eoa
or GenEst
, the full distributions
would be used.
The probability functions have a number of purposes. A few of the more commonly used are listed below.
- PDF and CDF (
ddd
andpdd
): -
to calculate the probability that carcass lands at a distance
x
meters from the turbine (or, more precisely, within 0.5 meters ofx
) or withinx
meters from the turbine, use a scalar value ofx
and a single model (dd
orddSim
) withddd
orpdd
, repspectively;to account for uncertainty in the probabilities at
x
, useddd
orpdd
for with scalarx
and a simulated set of parameters from the fitted model (ddSim
object). This would be useful for calculating confidence intervals for the probabilities;to calculate probabilities for a range of
x
values according to a single model, use a vectorx
with add
object or addSim
object with one row. This would be useful for drawing graphs of PDFs or CDFs;to calculate simulated probabilites for a range of
x
values, use a vectorx
and addSim
object of simulated parameter sets. This would be useful for drawing confidence regions around a fitted PDF or CDF.
- Inverse CDF (
qdd
): -
to calculate the distance that 100
p
% of the carcasses are expected to fall, use a scalarp
in the interval (0, 1) and a single model (dd
) or parameter set (ddSim
with one row);to calculate account for the uncertainty in estimating the inverse CDF for a given
p
, use a scalarp
and addSim
object. This would be useful for calculating a confidence interval for, say, the median or the expected 90th percentile of carcass distances;to calculate the inverse CDF for a range of probabilities for a single model, use a vector
p
and a single model (dd
orddSim
object with one row.
- Random Carcasses Distances (
rdd
): -
to generate
n
random carcass distances for a given (fixed) model, use add
object or addSim
object with a single row;to generate
n
random carcass distances for a model and account for the uncertainty in estimating the model, use addSim
object withn
rows, wheren
is also used as then
argument in the call tordd
.
- Relative Carcass Density (per m^2):
-
to calculate the relative carcass density at a number of distances, use a vector
x
. This would be useful in generating maps of carcass density at a site.
Value
vector or matrix of values; a vector is returned unless model
is a ddSim
object with more than one row and is to be calculated for
more than one value (x
, q
, p
), in which case an array
with dimensions length(x)
by nrow(model)
is returned (where
"x
" is x
, q
, or p
, depending on whether ddd
,
pdd
, or qdd
is called).
Examples
data(layout_simple)
data(carcass_simple)
sitedata <- initLayout(layout_simple)
ringdata <- prepRing(sitedata)
ringsWithCarcasses <- addCarcass(carcass_simple, data_ring = ringdata)
distanceModels <- ddFit(ringsWithCarcasses)
modelEvaluations <- modelFilter(distanceModels)
bestModel <- modelEvaluations$filtered
pdd(100, model = bestModel) # estimated fraction of carcasses within 100m
ddd(1:150, model = bestModel) # estimated PDF of the carcass distances
qdd(0.9, model = bestModel) # estimated 0.9 quantile of carcass distances
rdd(1000, model = bestModel) # 1000 random draws from estimated carcass distribution