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.
ddFit(x, ...)# S3 method for data.frame
ddFit(
x,
distr = "standard",
scVar = NULL,
rCol = "r",
expoCol = "exposure",
ncarcCol = "ncarc",
silent = FALSE,
...
)
# S3 method for rings
ddFit(
x,
distr = "standard",
scVar = NULL,
rCol = "r",
expoCol = "exposure",
ncarcCol = "ncarc",
silent = FALSE,
...
)
# S3 method for list
ddFit(
x,
distr = "standard",
scVar = NULL,
rCol = "r",
expoCol = "exposure",
ncarcCol = "ncarc",
silent = FALSE,
...
)
# S3 method for xyLayout
ddFit(
x,
distr = "standard",
scVar = NULL,
notSearched = NULL,
rCol = "r",
ncarcCol = "ncarc",
unitCol = "turbine",
silent = FALSE,
...
)
# S3 method for ringscc
ddFit(
x,
distr = "standard",
scVar = NULL,
rCol = "r",
expoCol = "exposure",
ncarcCol = "ncarc",
silent = FALSE,
...
)
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]]
.
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
names (vector of character strings) of glm distribution templates
to fit. Default is distr = "standard"
to fit the standard models listed in the
description above. Setting distr = "all"
will fit both the standard
models and the supplementary models. Also, any subset of the models may be fit
by using, for example, distr = c("xep01", "lognormal")
to fit only
the "xep01"
and "lognormal"
models, or
distr = exclude(c("xep123", "constant"))
to fit all standard models except
"xep123"
and "constant"
, or distr = exclude("lognormal",
mod_all)
to fit all the models except the lognormal.
Search class variable to include in the model (optional). scVar
is ignored if x
is not a shapeLayout
or xyLayout
object.
If x
is a shapeLayout
object, scVar
may be either NULL
or the name of a single column with search class data. If x
is an xyLayout
object, scVar
may be either NULL or a vector of names of search class
variables to include in the models.
name of the distance column (which gives the outer radii of the rings).
This will be correct by default for objects coming from prepRing
and will rarely need to be explicitly specified.
name of the column with the exposure, which is the area in the ring
with outer radius rCol
. This will be correct by default for objects
coming from prepRing
and will rarely need to be
explicitly specified.
name of the column with tallies of carcasses by ring. This
will be correct by default for objects coming from prepRing
and will rarely need to be explicitly specified.
set silent = TRUE
to suppress information printed to the
console as the calculations proceed, which may be useful when running
simulations.
the name of the level (if any) in scVar
that
indicates an unsearched area
name of the column with turbine IDs
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
Run the code above in your browser using DataLab