DeclareDesign / estimatr

estimatr: Fast Estimators for Design-Based Inference
https://declaredesign.org/r/estimatr
Other
131 stars 20 forks source link

lh_robust does not work with multiple outcomes #297

Open lukesonnet opened 5 years ago

lukesonnet commented 5 years ago

lho <- lh_robust(cbind(mpg, am) ~ cyl + gear, data = mtcars, linear_hypothesis = c("cyl = 2", "cyl = gear")) Output:

Error in constants(lhs, cnames_symb) : 
  The hypothesis "cyl = 2" is not well formed: contains bad coefficient/variable names.
In addition: Warning message:
In constants(lhs, cnames_symb) : NAs introduced by coercion
nfultz commented 5 years ago

car has a seperate method for mlm, you might be able to get this working by fiddling with the classes of the output object that lm_robust is producing.

On Mon, Mar 4, 2019 at 9:05 PM Luke Sonnet notifications@github.com wrote:

lho <- lh_robust(cbind(mpg, am) ~ cyl + gear, data = mtcars, linear_hypothesis = c("cyl = 2", "cyl = gear")) Output:

Error in constants(lhs, cnames_symb) : The hypothesis "cyl = 2" is not well formed: contains bad coefficient/variable names. In addition: Warning message: In constants(lhs, cnames_symb) : NAs introduced by coercion

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DeclareDesign/estimatr/issues/297, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZjTgYlKgv3oU5QATOAInZKOcIjNB7iks5vTfsmgaJpZM4bdyFZ .

lilymedina commented 5 years ago

method for mlm performs tests but doesn't compute variance or expected value of the linear combination of coefficients, so not so sure what would we include in the tidy output.

nfultz commented 5 years ago

:(

We may be able to decompose an mlm into a list of lm, but that seems a bit painful.

lukesonnet commented 5 years ago

Any advice here? I don't think we can very easily accommodate this and believe we should explicitly fail to support this with a message, while just returning the usual lm_robust() output.

acoppock commented 5 years ago

I think this should be an error that says you have to go outcome by outcome

lukesonnet commented 5 years ago

Anyone have any feelings re: error? I think that's also reasonable. I'll implement it as such later today/tomorrow if no other feedback.