ddFit {dwp} | R Documentation |
Fit Distance Distribution Model(s)
Description
Fit generalized linear models (glm) for distance distribution models corresponding to standard forms [xep1, xep01 (gamma), xep2 (Rayleigh), xep02, xep12, xep012, xep123, xep0123 (normal-gamma with x = tau), lognormal, truncated normal, Maxwell Boltzmann, and constant] and supplentary forms [exponential, chi-squared, inverse gamma, and inverse Gaussian].
The glm is converted to a probability distribution by dividing by a
normalizing constant, namely the integral of the glm evaluated from 0 to
infinity. In some cases (most notably when the leading coefficient of the
glm is positive so the fitted curve does not converge to zero as x increases),
converted to a probability distribution. In these cases, the distribution
parameters are given as NA
, but the fitted model itself is saved.
Usage
ddFit(x, ...)
## S3 method for class 'data.frame'
ddFit(
x,
distr = "standard",
scVar = NULL,
rCol = "r",
expoCol = "exposure",
ncarcCol = "ncarc",
silent = FALSE,
...
)
## S3 method for class 'rings'
ddFit(
x,
distr = "standard",
scVar = NULL,
rCol = "r",
expoCol = "exposure",
ncarcCol = "ncarc",
silent = FALSE,
...
)
## S3 method for class 'list'
ddFit(
x,
distr = "standard",
scVar = NULL,
rCol = "r",
expoCol = "exposure",
ncarcCol = "ncarc",
silent = FALSE,
...
)
## S3 method for class 'xyLayout'
ddFit(
x,
distr = "standard",
scVar = NULL,
notSearched = NULL,
rCol = "r",
ncarcCol = "ncarc",
unitCol = "turbine",
silent = FALSE,
...
)
## S3 method for class 'ringscc'
ddFit(
x,
distr = "standard",
scVar = NULL,
rCol = "r",
expoCol = "exposure",
ncarcCol = "ncarc",
silent = FALSE,
...
)
Arguments
x |
a search plot layout object to fit carcass distribution models to. The layout may be a data frame with columns for ring radii, exposure (or searched area in each ring), search class variable (optional), and number of carcasses in each ring; |
... |
ignored |
distr |
names (vector of character strings) of glm distribution templates
to fit. Default is |
scVar |
Search class variable to include in the model (optional). |
rCol |
name of the distance column (which gives the outer radii of the rings).
This will be correct by default for objects coming from |
expoCol |
name of the column with the exposure, which is the area in the ring
with outer radius |
ncarcCol |
name of the column with tallies of carcasses by ring. This
will be correct by default for objects coming from |
silent |
set |
notSearched |
the name of the level (if any) in |
unitCol |
name of the column with turbine IDs |
Value
A list of fitted glm models as dd
objects in a
ddArray
object if a vector of distributions is fit, or a single dd
object if a single model is fit. The dd
objects are
lists that include the following elements:
glm
the fitted model
$distr
name of the distribution (
"xep01"
, etc.)$parms
vector of distribution parameter estimates (or
NA
if the model based on the MLE is not extensible)$varbeta
the variance-covariance matrix of the glm parameter estimates. NOTE: This is identical to the covariance matrix from the glm, which can be extracted via
summary(x)$cov.unscaled
$scVar
name of the (optional) search class variable (or
NULL
)$ncarc
number of carcasses
$aicc
the AICc value of the fit
$n
number of rings
$k
number of parameters
$srad
search radius
When a dd
object is printed, only a small subset of the elements are
shown. To see a full list of the objects, use names(x)
. The elements
can be extracted in the usual R way via $
or [[x]]
.
Examples
data(layout_simple)
data(carcass_simple)
sitedata <- initLayout(layout_simple) # initialize
ringdata <- prepRing(sitedata) # format site layout data for modeling
ringsWithCarcasses <- addCarcass(carcass_simple, data_ring = ringdata) # add carcasses to site
distanceModels <- ddFit(ringsWithCarcasses) # fit distance models