Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mediation #219

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Mediation #219

wants to merge 10 commits into from

Conversation

lilymedina
Copy link
Contributor

Description

mediation_analysis_designer with Imai's package feature. Finally!
it needs GitHub's version of broom.

Checklist:

  • Designer is documented according to the contributing guidelines
  • Designer and any vignettes have been added to overview.csv
  • Tests added to testthat to ensure coverage remains at 100%
  • Branch is passing devtools::check() with 0 errors, warnings, or notes

Copy link
Contributor

@nfultz nfultz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall lgtm - but I think mediation should be a suggests and not an includes, because it is only used for one design at the moment and not more generally useful.

importFrom(DeclareDesign,redesign)
importFrom(DeclareDesign,set_diagnosands)
importFrom(DeclareDesign,tidy_estimator)
importFrom(broom,tidy)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pull in tidy from generics.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank for reviewing!

DESCRIPTION Outdated
@@ -27,7 +27,9 @@ Depends:
estimatr (>= 0.14.0)
Imports:
generics,
rlang
rlang,
mediation,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mediation should probably be a suggets and not an imports.

mediator_regression + stage2_1 + stage2_2 + stage2_3
)

if(mediation_package){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stopifnot(requireNamespace("mediation"))

# QBA: Quasi-Bayesian Approximation
e1 <- lm(M ~ Z, data = data)
e2 <- lm(Y ~ M + Z + M:Z, data = data)
m <- mediate(e1, e2, sims = 100, treat = "Z", mediator = "M")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mediation::mediate and remove import

@jaspercooper
Copy link
Contributor

We're getting errror

No tidy method for objects of class mediate
I suppose because our PR for a tidy method hasn't been merged yet?

@lilymedina
Copy link
Contributor Author

PR has been merged, but it's not in the latest cran version, so not sure how generics handles that.

When I include importFrom broom,tidy it seems to be working fine, but let me revise again.

Sorry, this has been sitting here for so long!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants