R/logisticbyx.R

#' Logistic as a function of covariates
#'
#' treats logistic as a function of covariates; for a given covariate
#' combination it computes function at with those covariate values at a
#' range of distances
#'
#' @param distance vector of distance values
#' @param x covariate data
#' @param models model list
#' @param beta logistic parameters
#' @param point \code{TRUE} if a point transect model
#'
#' @return vector of probabilities
#' @author Jeff Laake
logisticbyx <- function (distance, x, models, beta, point){

  # Functions used: g0, setcov

  xlist <- as.list(x)
  xlist$distance <- distance
  xmat <- expand.grid(xlist)

  if(!point){
    return(g0(beta, setcov(xmat, models$g0model)))
  }else{
    return(g0(beta, setcov(xmat, models$g0model))*2*distance)
  }
}

Try the mrds package in your browser

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

mrds documentation built on May 29, 2024, 3:56 a.m.