View source: R/predLikelihood.R
predLikelihood | R Documentation |
An internal prediction function to predict (compute)
the values of distance functions at a set of observed values.
Unlike predDfuncs
, which evaluates distance
functions at EVERY input distance, this routine evaluates
distance functions at only ONE distance. This is what's
appropriate for likelihood computation.
This version allows for matrix inputs and
uses matrix operations, and is thus faster than earlier
looping versions.
predLikelihood(object, params)
object |
An Rdistance model frame or fitted distance function,
normally produced by a call to |
params |
A matrix of distance function parameters. Rows are observations, columns contain the set of parameters (canonical and expansion) for each observation. |
Assuming L
is the vector returned by this function,
the negative log likelihood is -sum(log(L / I), na.rm=T)
,
where I
is the integration constant, or
area under the likelihood between
w.lo
and w.hi
.
Note that returned likelihood values for distances less
than w.lo
or greater than w.hi
are NA
;
hence, na.rm=TRUE
in the sum.
A vector of distance function values, of length
n = number of observed distances = length(distances(x)).
Elements in distances(x)
correspond, in order,
to values in the returned vector.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.