R/RRlink_logit.R

Defines functions RRlink.logit

Documented in RRlink.logit

############ RR logit link function######

#' Logit link function with Randomized Response parameters.
#'
#'
#' @param c
#' a numeric vector containing the parameter c.
#' @param d
#' a numeric vector containing the parameter d.
#' @return
#' RR link function.
#'
#' @export
RRlink.logit <- function(c,d) {
  ## link
  linkfun <- function(y) log((y-c)/(c+d-y))
  ## inverse link
  linkinv <- function(eta) c + d*(exp(eta)/(1+exp(eta)))
  ## derivative of invlink wrt eta
  mu.eta <- function(eta) {d*exp(eta)/((1+exp(eta))**2)}
  valideta <- function(eta) TRUE
  link <- "RRlogit"
  structure(list(linkfun = linkfun, linkinv = linkinv,
                 mu.eta = mu.eta, valideta = valideta,
                 name = link),class = "link-glm")
}

Try the GLMMRR package in your browser

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

GLMMRR documentation built on Jan. 16, 2021, 5:28 p.m.