Closed jwasserman2 closed 2 years ago
Good testing! These fail due to model.frame
failing when called on a DirectAdjusted
object. I ended up 1) adding model.frame
to our growing list of functions to search in the call stack for and 2) adding the Design
object to the DirectAdjusted
frozen environment to accommodate cases when model.frame
is called using terms(DirectAdjusted)
or formula(DirectAdjusted)
as an argument. I don't know of a way to access the original fitted model if someone calls terms(DirectAdjusted)
or formula(DirectAdjusted)
, so unless you know of such a way, then accessing the Design
slot doesn't work for those cases. Instead, since the model's environment is accessible from either terms
or formula
, we can search for the design there.
Two issues still to resolve (in next commits):
vcovDA(lmitt(y ~ x, design = z ~ uoa(cid1, cid2) + block(bid), data = simdata, weights = ate(), offset = cov_adj(camod)))
fails with an infinite recursion errorvcovDA(lmitt(y ~ x, data = simdata, weights = ate(des), offset = cov_adj(camod)))
is returning a 2x2 matrix with dimensions for the intercept and x:adopters()
, but this should be a 3x3 matrix including a column for adopters()
on its own (since here x
is continuous).Ok this last commit addresses point 1 mentioned above. .get_design()
now searches first in the lmitt.formula
frame for design
, which should have been provided by the user or created from the formula provided by the user, and returns it immediately to prevent reaching a point of infinite recursion. If a Design
object is found in the lmitt.formula
frame it is no longer compared to other Design
objects found in the call stack to ensure agreement. @josherrickson let me know if this is OK. Otherwise, this PR should be ready to merge
** EDIT: change "uniqueness" to "agreement"
I'm also going to go ahead and merge this in. It fixes a lot of versions of lmitt
The following still fails: