Skip to content

Commit

Permalink
Wrong DFs in model_parameters.fixest
Browse files Browse the repository at this point in the history
Fixes #892
  • Loading branch information
strengejacke committed Sep 9, 2023
1 parent a8092dd commit fd11fb6
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,9 @@ S3method(model_parameters,emm_list)
S3method(model_parameters,epi.2by2)
S3method(model_parameters,fa)
S3method(model_parameters,fa.ci)
S3method(model_parameters,feglm)
S3method(model_parameters,fitdistr)
S3method(model_parameters,fixest)
S3method(model_parameters,fixest_multi)
S3method(model_parameters,flac)
S3method(model_parameters,flic)
Expand Down
64 changes: 64 additions & 0 deletions R/methods_fixest.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,66 @@
# .fixest -----------------------

#' @export
model_parameters.fixest <- function(model,
ci = 0.95,
ci_method = NULL,
bootstrap = FALSE,
iterations = 1000,
standardize = NULL,
exponentiate = FALSE,
p_adjust = NULL,
summary = getOption("parameters_summary", FALSE),
keep = NULL,
drop = NULL,
verbose = TRUE,
vcov = NULL,
vcov_args = NULL,
...) {
# default ci-method, based on statistic
if (is.null(ci_method)) {
if (identical(insight::find_statistic(model), "t-statistic")) {
ci_method <- "residual"
} else {
ci_method <- "wald"
}
}

# extract model parameters table, as data frame
out <- tryCatch(
{
.model_parameters_generic(
model = model,
ci = ci,
ci_method = ci_method,
bootstrap = bootstrap,
iterations = iterations,
merge_by = "Parameter",
standardize = standardize,
exponentiate = exponentiate,
p_adjust = p_adjust,
summary = summary,
keep_parameters = keep,
drop_parameters = drop,
vcov = vcov,
vcov_args = vcov_args,
verbose = verbose,
...
)
},
error = function(e) {
NULL
}
)

if (is.null(out)) {
insight::format_error("Something went wrong... :-/")
}

attr(out, "object_name") <- insight::safe_deparse_symbol(substitute(model))
out
}


#' @export
standard_error.fixest <- function(model, vcov = NULL, vcov_args = NULL, ...) {
params <- insight::get_parameters(model)
Expand Down Expand Up @@ -45,6 +106,9 @@ degrees_of_freedom.fixest <- function(model, method = "wald", ...) {

# .feglm -----------------------

#' @export
model_parameters.feglm <- model_parameters.fixest

#' @export
standard_error.feglm <- function(model, ...) {
stats <- stats::coef(summary(model))
Expand Down
2 changes: 1 addition & 1 deletion man/p_function.Rd

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

0 comments on commit fd11fb6

Please sign in to comment.