Open malcolmbarrett opened 1 year ago
Ok I think this is how you'd calculate the overlap weight, and if correct, no it doesn't seem to really help :(
n <- 1000
a <- 10
b <- 1
p <- 0.5
c <- rbinom(n, 1, p)
x <- a * c + rnorm(n)
y <- b * c + rnorm(n)
denominator_model <- lm(
x ~ c
)
p <- dnorm(x, fitted(denominator_model), sigma(denominator_model))
f <- function(a) {
sum(dnorm(x, a, sigma(denominator_model)))
}
overlap <- purrr::map_dbl(fitted(denominator_model), f)^(-1) * (1 / p)
Created on 2022-11-18 by the reprex package (v2.0.1)
But I'm not confident. It is easier for me to conceptualize in the binary treatment case, in which case the weight is:
(1/ (1/p + 1/(1-p))) * 1/p * (x == 1) + (1/ (1/p + 1/(1-p))) * 1/(1-p) * (x == 0)
but here "p" is the propensity score (probability that treatment = 1 | x) where as in the continuous case p = the probability of getting the treatment that you got.
Assuming this is the right calculation, wouldn't that suggest either 1) there is something fundamentally wrong with ATO weights in continuous cases or 2) the issue is not the extremeness of the weights? Because in theory, they should address most of the issues of positivity, no?
So for continuous exposures, the stabilization numerator in IPW is crucial to avoid infinite variance. I think you handled this correctly in the main code, but I wonder if that numerator should also be used here when adding the overlap weights?
I'm not very familiar with overlap weights, but essentially we are down-weighting people with extreme PS / extreme weights right? In the discrete case, they frame the problem as down-weighting extreme PS, but since the PS are unstable in continuous case when using densities, maybe it's better framed as down-weighting extreme weights (including stabilizing numerator) in our case.
Or otherwise, maybe trimming will do better?
e.g. trimming, overlap weights, filtering to a subset? End-to-end weights (however you calculate those 😲)?