logiterr: Logit link accounting for classification error.

View source: R/logiterr.R

logiterrR Documentation

Logit link accounting for classification error.

Description

Link function for a logistic regression model where the response variable is subject to classification error with known sensitivity and specificity.

Usage

logiterr(sens = 1, spec = 1)

Arguments

sens

Sensitivity (i.e., the probability of a positive response given that the true classification is positive).

spec

Specificity (i.e., the probability of a negative response given that the true classification is negative).

Details

The inverse link function is a/(1 + exp(-\eta)) + (1-b)/(1 + exp(\eta)) where a and b are the sensitivity and specificity, respectively. Note that this is essentially a mixture model. The link function is log((1 - b - \mu)/(\mu - a)).

Note

User-specified starting values may be necessary when the sensitivity and/or specificity are relatively low. One strategy is to obtain starting values from a model where the sensitivity and specificity are both specified as larger values (or one).

Examples

library(dplyr)

# simulate response with sensitivity of 0.8 and specificity of 0.9
d <- data.frame(x = seq(-3, 3, length = 1000)) %>% 
   mutate(y = rbinom(n(), 1, 0.8 * plogis(x) + (1 - 0.9) * plogis(-x)))
   
# estimate model with link function accounting for sensitivity and specificity    
m <- glm(y ~ x, family = binomial(link = logiterr(0.8, 0.9)), data = d)
summary(m)$coefficients


trobinj/trtools documentation built on Jan. 28, 2024, 3:20 a.m.