View source: R/integrateDfuncs.R
| integrateDfuncs | R Documentation |
Integrates under distances functions using exact integrals when possible. If exact integrals are not known, numerical integration is used.
integrateDfuncs(object, ml)
object |
Either an Rdistance fitted distance function
(an object that inherits from class "dfunc"; usually produced
by a call to |
ml |
Either a Rdistance 'model frame' or an Rdistance
'fitted object'. Both are of class "dfunc".
Rdistance 'model frames' are lists containing components
necessary to estimate a distance function, but no estimates.
Rdistance 'model frames' are typically
produced by calls to |
Let K be the integral under distance function g(x) (i.e., the output from this routine). In distance analysis, the observation likelihood being evaluated for maximization is the density, f(x) = g(x)/K. K is a key quantity in distance analysis and is called the "effective sampling distance".
A vector of areas under the distance functions represented in
object.
If object is a distance function and
newdata is specified, the returned vector's length is
nrow(newdata). If object is a distance function and
newdata is NULL,
returned vector's length is length(distances(object)). If
object is a matrix, return's length is
nrow(object).
Users will not normally call this function. It is called
internally by nLL and effectiveDistance.
# Faking a model frame
ml <- list( likelihood = "halfnorm"
, expansions = 0
, w.lo = 0 %m% .
, w.hi = 100 %m% .
, Units = "m"
)
attr(ml, "transType") <- "line"
parms <- matrix(75, nrow = 1)
integrateDfuncs(parms, ml)
# check: Normal, 0 to 100, sd = 75, scaled to mode = 1
(pnorm(q = 100, mean = 0, sd = 75) - 0.5) * sqrt(2*pi)*75
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.