R/logLik.dsmodel.R

Defines functions logLik.dsmodel

Documented in logLik.dsmodel

#' log-likelihood value for a fitted detection function
#'
#' Extract the log-likelihood from a fitted detection function.
#'
#' @param object a fitted detection function model object
#' @param \dots included for S3 completeness, but ignored
#' @return a numeric value giving the log-likelihood with two attributes: \code{"df"} the "degrees of freedom" for the model (number of parameters) and \code{"nobs"} the number of observations used to fit the model
#' @export
#' @author David L Miller
logLik.dsmodel <- function(object, ...){

  # see ?logLik for information on why

  ret <- object$ddf$lnl

  attr(ret, "df") <- length(object$ddf$par)
  attr(ret, "nobs") <- nrow(object$ddf$data)

  class(ret) <- "logLik"
  return(ret)
}

Try the Distance package in your browser

Any scripts or data that you put into this service are public.

Distance documentation built on July 4, 2017, 9:29 a.m.