Closed josherrickson closed 1 year ago
Solved this. The absorb branch is now (almost) fully working!
The remaining errors in the tests are all in test.SandwichLayerVariance.R or the SandwichLayer stuff of tests.DirectAdjusted.R and almost all in the .get_b*
functions, which are being deprecated. I'm going to hold off debugging those until @jwasserman2's branch gets brought in.
I've merged in main which brought in a few more problems related to SandwichLayer, but again I suspect that these will be fixed (or made irrelevant).
I'm getting ready to head out of town for a few days so just documenting my current status on absorb to get back into when I return.
Current issue is with
subset
. Problem: When to subset? One of the first things I do is evaluate$weights
and$offset
to avoid scoping issues, but these don't account for the$subset
(in a directlm()
call, I believe subsetting happens during themodel.frame
call in which said model.frame already has offset/weights included). If I subset too early, that breaks things elsewhere that is expecting an unsubsetted data.Potential solutions: 1) Subset data immediately and figure out a way to handle it going forward. May require adding a
subset=
argument to weights andcov_adj()
. This also might be problematic with regards to obtaining the data post-estimation. 2) Restructure the whole function to generate amodel.frame
immediately then pass that around. Not sure how this will play with existing architecture like.get_data_from_model
. 3) Ignore subsetting until the finallm
. I think this has the most promise. I can strip out the$subset
piece of the call as I hack around the calls, then add it just prior to evaluating the finallm()
.(One point where this is causing issue -
model.matrix.default
does not support anna.action=
argument.model.matrix.lm
DOES support thena.action=
argument but does not appear to supportsubset=
.)