Skip to content

Some observed user errors #5

@adamSales

Description

@adamSales

Someone I'm working with just made a couple of errors in using the code and asked me about them, so I figured I would list them here so maybe we could build some safeguards into the software.

  • they included the outcome and the condition variables in the covariate matrix. As it stands, I don't really know how best to protect against this, but if we allow users to specify covariates as a formula (like in estimatr) then we can test to see if any of the elements in the formula have the same name as the outcome and condition variables in the call. I wonder what other packages do?
  • I think that either the outcome or the treatment variable were factors. This sort of thing should be easy to test for, then we can give informative error messages.

(if we had a formula interface, I could imagine specifying like this:

loop(formula=Y~Tr,Z=~x1+x2,data=df)

then include the line

if(length(intersect(all.vars(formula),all.vars(Z)))) stop("Outcome and/or Treatment variables cannot be included as covariates.")

or something of that sort)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions