The example is from https://www.hsph.harvard.edu/miguel-hernan/causal-inference-book/. Chapter 12.
In causal inference, it is common to get inverse probability weighting then fit the weighted regression model. After the weighting is done, here is the code (two ways to fit the weighted regression)
gee.obj <- geeglm(wt82_71~qsmk, data = nhefs0, weight=w, id=seqn, corstr="independence")
glm.obj <- glm(wt82_71 ~ qsmk + cluster(seqn), data = nhefs0, weights = w)
I am wondering:
What do these two commands mean? The R documentation is really confusing... The book indicates that the above is a “sandwich estimator”. I know that it is a robust procedure for misspecification while the code looks like a longitudinal procedure. The data do not have that structure at all (e.g., seqn is unique so there is only one element in each cluster)...
Also, if you can comment on how the robust procedure is compared to a simple lm(wt82_71~qsmk, weight=w), I will deeply appreciate it
All data are downloadable from the website if you want to try.