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

Lean false #58

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
allows for obtaining the linear prediction for non-linear models. Internally
passed as `marginaleffects::slopes(..., type = predict)`, thus avoiding a clash
with the topline `emfx(..., type = <aggregration_type>)` argument. (#49)
- `emfx(..., lean = TRUE)` ensures a light return object by default, by
stripping away data-heavy attributes that are unlikely to be needed afterwards.
(#51)
- `emfx(..., lean = <logical>)`. Default value is `FALSE`, but switching to
`TRUE` will ensure a light return object that strips away data-heavy attributes
(e.g., copies of the original model). These attributes are unlikely to be needed
as part of the `emfx()` workflow, so we may change the default to `lean = TRUE`
in a future version of **etwfe**. (#51, #58)
- Native `plot.emfx()` method (via a **tinyplot** backend) for visualizing
`emfx` objects. (#54)

Expand Down
17 changes: 8 additions & 9 deletions R/emfx.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,13 @@
#' that behaviour via `FALSE` is _strictly_ performative: the "zero" treatment
#' effects for any pre-treatment periods is purely an artefact of the
#' estimation setup.
#' @param lean Logical. Enforces a lean return object; namely a simple
#' data.frame of the main results, stripped of ancillary attributes. Defaults
#' to `TRUE`, in which case `options(marginaleffects_lean = TRUE)` is set
#' internally at the start of the `emfx` call, before being reverted upon
#' exit. Note that this will disable some advanced `marginaleffects`
#' post-processing features, but those are unlikely to be used in the `emfx`
#' context and means that we can dramatically reduce the size of the return
#' object.
#' @param lean Logical. Default is `FALSE`. Switching to `TRUE` enforces a lean
#' return object; namely a simple data.frame of the main results, stripped of
#' ancillary attributes. Note that this will disable some advanced
#' `marginaleffects` post-processing features, but those are unlikely to be
#' used in the `emfx` context. The upside is a potentially dramatic reduction
#' in the size of the return object. Consequently, we may change the default
#' to `TRUE` in a future version of **etwfe**.
#' @param ... Additional arguments passed to
#' [`marginaleffects::slopes`]. For example, you can pass `vcov =
#' FALSE` to dramatically speed up estimation times of the main marginal
Expand Down Expand Up @@ -105,7 +104,7 @@ emfx = function(
collapse = compress,
predict = c("response", "link"),
post_only = TRUE,
lean = TRUE,
lean = FALSE,
...
) {

Expand Down
17 changes: 8 additions & 9 deletions man/emfx.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vignettes/etwfe.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ modelsummary(
list(mod_es2, mod_es),
shape = term:event:statistic ~ model,
coef_rename = rename_fn,
gof_omit = "Adj|Within|IC|RMSE",
stars = TRUE,
title = "Event study",
notes = "Std. errors are clustered at the county level"
Expand Down
Loading