Calculates and adds the scores to a fitted model object
Source:R/model-object-modifiers.R
add_scores.RdCalculates and adds the scores to a fitted model object.
The scores are the gradient observations/first derivatives of the
observation-level log-likelihood function. The function is a wrapper around
numDeriv::jacobian().
Arguments
- object
A fitted model object
- func
A function with real (vector) results returning the function values at the observation level. This is either the log-likelihood function, or, as expected by
bgw::bgw_mle(), the likelihood function (probabilities).- x
A real or real vector argument to func, indicating the point at which the gradient is to be calculated. Defaults to the estimated coefficients.
- log_transform
A logical value indicating if
funcreturns likelihoods that must be log transformed before differentiating. Defaults toTRUEfor objects of classbgw_mleandFALSEotherwise.- ...
Additional arguments passed to
numDeriv::jacobian().