Case Replacement for Logistic Regression Replace cases with null hypothesis cases. What is a null hypothesis case? One in which probability of success is independent of predictor You switch some treatment success cases to treatment failure case
Neighborhood Effects: Even Logistic Leverages Product of Associations Odds ratio relating treatment to outcome Odds ratio relating omitted variable to outcome Increments of Γ matter more as Δ increases. Correlation between Γ Δ and odd ratio is -.96 Odds ratio relating omitted variable to treatment Harding, D. J. (2003). Counterfactual models of neighborhood effects: The effect of neighborhood poverty on dropping out and teenage pregnancy. American Journal of Sociology, 109(3), 676-719.
Replacement of Cases for Logistic: Toy Example Failure Success Total Control 16 9 25 Treatment 4 21 20 30 50 Odds ratio=16*21/(4*9)=9.3 Odds ratio=9.33. ln(odds ratio)=2.234. se=.686 =(1/16+1/9+1/4+1/21) Threshold =t critical*.686=1.96*.686=1.345 % bias to invalidate=1-1.345/2.2335=40%
Replacement of Cases for Logistic = Switching Cases: Toy Example Failure Success Total Control 16 9 25 Treatment 4 21 20 30 50 7 18 New odds ratio=16*18/(9*7)=4.57 23 27 How many treatment success must you replace with null hypothesis (p=30/50=.6) to invalidate the inference How many to switch from treatment success to treatment failure: % bias to invalidate=1-1.345/2.2335=40% Replace 40% of treatment successes (n=21)=8 cases Replace with null hypothesis cases (p of success=.6). So switch 8*(1-.6): =about 3.2 cases from treatment success to treatment failure. # of cases to switch=% bias to invalidate*(treatment success cases)*(1-overall probability of success).
Replacement of Cases for Logistic: Toy Example Failure Success Total Control 16 9 25 Treatment 4 21 20 30 50 Failure Success Total Control Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Treatment Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ
Replacement of Cases for Logistic: Toy Example Failure Success Total Control Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Treatment Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Ꙫ Replace 8 cases = switch 3 cases Ln(p/(1-p)=β0 +β1 treatment. H0:β1 =0 Ln(p/(1-p)=β0 p=.6
R code brute force setwd("C:/Users/user/Dropbox (Personal)/sensitivity for logistics") rm(list = ls()) A <- 29 B <- 26 C <- 15 D <- 40 x <- matrix(c(A,B,C,D), byrow = TRUE, 2, 2) # this is the 2 by 2 table we start with p.CD <- p.value <- chisq.test(x,correct = FALSE)$p.value N.CD <- 0 while ( p.value <0.05 ) { C <- C + 1 D <- D - 1 N.CD <- N.CD + 1 print(x) print(chisq.test(x,correct = FALSE)) p.value <- chisq.test(x,correct = FALSE)$p.value p.CD <- c(p.CD, chisq.test(x,correct = FALSE)$p.value) } p.AB <- p.value <- chisq.test(x,correct = FALSE)$p.value N.AB <- 0 A <- A - 1 B <- B + 1 N.AB <- N.AB + 1 p.AB <- c(p.AB, chisq.test(x,correct = FALSE)$p.value) # so p.AB and p.CD record the p values each time we switch one case # N.AB = 5 (5 cases needed to be changed from A to B) # N.CD = 4 (4 cases needed to be changed from D to C)
KonFound-it for Logistic Regression https://jmichaelrosenberg.shinyapps.io/shinykonfound/
Reflection What part if most confusing to you? Why? More than one interpretation? Talk with one other, share Find new partner and problems and solutions