Skip to content

Commit 2cbd5d7

Browse files
committed
v0.9.3
1 parent f0baba2 commit 2cbd5d7

35 files changed

+1146
-215
lines changed

CRAN-SUBMISSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Version: 0.9.1
2-
Date: 2025-03-25 23:22:22 UTC
3-
SHA: fc58c42812fa68d356bf3fcb681b4230b1143e22
2+
Date: 2025-04-03 17:51:05 UTC
3+
SHA: f0baba24fb45b4808e8dfbe8c3151f66902fd082

DESCRIPTION

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ Authors@R: c(
99
family = "Vargas Sepulveda",
1010
role = c("aut", "cre"),
1111
email = "[email protected]",
12-
comment = c(ORCID = "0000-0003-1017-7574"))
12+
comment = c(ORCID = "0000-0003-1017-7574")),
13+
person(
14+
given = "Yoto",
15+
family = "Yotov",
16+
role = c("ctb"))
1317
)
1418
Imports:
1519
data.table,

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ S3method(print,felm)
2424
S3method(print,summary.apes)
2525
S3method(print,summary.feglm)
2626
S3method(print,summary.felm)
27+
S3method(print,summary_table)
2728
S3method(summary,apes)
2829
S3method(summary,feglm)
2930
S3method(summary,felm)
@@ -43,6 +44,7 @@ export(fenegbin)
4344
export(fepoisson)
4445
export(fixed_effects)
4546
export(glance)
47+
export(summary_table)
4648
export(tidy)
4749
importFrom(Formula,Formula)
4850
importFrom(MASS,negative.binomial)

NEWS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# capybara 0.9.3
2+
3+
* Fixes the `tidy()` method for linear models (`felm` class). Now it does not
4+
require to load the `tibble` package to work.
5+
* Adds a wrapper to present multiple models into a single table with the option
6+
to export to LaTeX.
7+
18
# capybara 0.9.2
29

310
* Implements Irons and Tuck acceleration for fast convergence.

R/autoplot.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ autoplot.feglm <- function(object, ...) {
7575
}
7676

7777
# Extract the summary of the feglm object
78-
res <- summary(object)$cm
78+
res <- summary(object)$coefficients
7979
colnames(res) <- c("estimate", "std.error", "statistic", "p.value")
8080

8181
# Calculate the critical value for the specified confidence conf_level
@@ -162,7 +162,7 @@ autoplot.felm <- function(object, ...) {
162162
}
163163

164164
# Extract the summary of the felm object
165-
res <- summary(object)$cm
165+
res <- summary(object)$coefficients
166166
colnames(res) <- c("estimate", "std.error", "statistic", "p.value")
167167

168168
# Calculate the critical value for the specified confidence conf_level

R/generics_coef.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#' @srrstats {G2.1a} Ensures that the input object is of the expected class (`apes`, `feglm`, or `felm`).
44
#' @srrstats {G3.1a} Outputs coefficients in a consistent format for interpretability.
55
#' @srrstats {G3.1b} Supports multiple model object types, maintaining a standardized interface.
6-
#' @srrstats {G3.1c} Provides access to summary statistics (`cm`) where applicable.
6+
#' @srrstats {G3.1c} Provides access to summary statistics (`coefficients`) where applicable.
77
#' @srrstats {G5.1} Includes robust error handling for unsupported or invalid input objects.
88
#' @srrstats {G5.4a} Includes tests for extracting coefficients from simple and complex model objects.
99
#' @srrstats {RE4.2} Returns coefficients via a standard method for feglm-type objects and derived classes (i.e., felm, apes, etc).
@@ -33,17 +33,17 @@ coef.felm <- function(object, ...) {
3333
#' @export
3434
#' @noRd
3535
coef.summary.apes <- function(object, ...) {
36-
object[["cm"]]
36+
object[["coefficients"]]
3737
}
3838

3939
#' @export
4040
#' @noRd
4141
coef.summary.feglm <- function(object, ...) {
42-
object[["cm"]]
42+
object[["coefficients"]]
4343
}
4444

4545
#' @export
4646
#' @noRd
4747
coef.summary.felm <- function(object, ...) {
48-
object[["cm"]]
48+
object[["coefficients"]]
4949
}

R/generics_confint.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ NULL
1616
#' @noRd
1717
confint.feglm <- function(object, parm, level = 0.95, ...) {
1818
# Extract the summary of the feglm object
19-
res <- summary(object)$cm
19+
res <- summary(object)$coefficients
2020
colnames(res) <- c("estimate", "std.error", "statistic", "p.value")
2121

2222
# Calculate the critical value for the specified confidence level

R/generics_glance.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ glance.feglm <- function(x, ...) {
4141
glance.felm <- function(x, ...) {
4242
with(
4343
summary(x),
44-
tibble(
44+
data.frame(
4545
r.squared = r.squared,
4646
adj.r.squared = adj.r.squared,
4747
nobs_full = nobs["nobs_full"],

R/generics_print.R

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ summary_family_ <- function(x) {
3737
#' @noRd
3838
summary_estimates_ <- function(x, digits) {
3939
cat("\nEstimates:\n\n")
40-
coefmat <- as.data.frame(x[["cm"]])
40+
coefmat <- as.data.frame(x[["coefficients"]])
4141

4242
coefmat <- summary_estimates_signif_(coefmat, digits)
4343
coefmat <- summary_estimates_cols_(coefmat, digits)
@@ -246,7 +246,7 @@ print.felm <- function(x, digits = max(3L, getOption("digits") - 3L), ...) {
246246
print.summary.apes <- function(
247247
x, digits = max(3L, getOption("digits") - 3L), ...) {
248248
cat("Estimates:\n")
249-
printCoefmat(x[["cm"]], P.values = TRUE, has.Pvalue = TRUE, digits = digits)
249+
printCoefmat(x[["coefficients"]], P.values = TRUE, has.Pvalue = TRUE, digits = digits)
250250
}
251251

252252
#' @title Print method for 'feglm' summary objects
@@ -283,3 +283,13 @@ print.summary.felm <- function(
283283

284284
summary_nobs_(x)
285285
}
286+
287+
#' Print method for regression tables
288+
#' @param x A summary_table object
289+
#' @param ... Additional arguments passed to other methods
290+
#' @export
291+
#' @noRd
292+
print.summary_table <- function(x, ...) {
293+
cat(x$content, sep = "\n")
294+
invisible(x)
295+
}

R/generics_summary.R

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ summary.apes <- function(object, ...) {
2323
se <- sqrt(diag(object[["vcov"]]))
2424
z <- est / se
2525
p <- 2.0 * pnorm(-abs(z))
26-
cm <- cbind(est, se, z, p)
27-
rownames(cm) <- names(est)
28-
colnames(cm) <- c("Estimate", "Std. Error", "z value", "Pr(>|z|)")
26+
coefficients <- cbind(est, se, z, p)
27+
rownames(coefficients) <- names(est)
28+
colnames(coefficients) <- c("Estimate", "Std. Error", "z value", "Pr(>|z|)")
2929

3030
# Return coefficient matrix
31-
structure(list(cm = cm), class = "summary.apes")
31+
structure(list(coefficients = coefficients), class = "summary.apes")
3232
}
3333

3434
#' @title Summary method for fixed effects GLMs
@@ -44,20 +44,20 @@ summary.feglm <- function(
4444
se <- sqrt(diag(vcov(object, type)))
4545
z <- est / se
4646
p <- 2.0 * pnorm(-abs(z))
47-
cm <- cbind(est, se, z, p)
48-
rownames(cm) <- names(est)
49-
colnames(cm) <- c("Estimate", "Std. Error", "z value", "Pr(>|z|)")
47+
coefficients <- cbind(est, se, z, p)
48+
rownames(coefficients) <- names(est)
49+
colnames(coefficients) <- c("Estimate", "Std. Error", "z value", "Pr(>|z|)")
5050

5151
# Generate result list
5252
res <- list(
53-
cm = cm,
54-
deviance = object[["deviance"]],
53+
coefficients = coefficients,
54+
deviance = object[["deviance"]],
5555
null_deviance = object[["null_deviance"]],
56-
iter = object[["iter"]],
57-
nobs = object[["nobs"]],
58-
lvls_k = object[["lvls_k"]],
59-
formula = object[["formula"]],
60-
family = object[["family"]]
56+
iter = object[["iter"]],
57+
nobs = object[["nobs"]],
58+
lvls_k = object[["lvls_k"]],
59+
formula = object[["formula"]],
60+
family = object[["family"]]
6161
)
6262

6363
if (object[["family"]][["family"]] == "poisson") {
@@ -92,9 +92,9 @@ summary.felm <- function(
9292
se <- sqrt(diag(vcov(object, type)))
9393
z <- est / se
9494
p <- 2.0 * pnorm(-abs(z))
95-
cm <- cbind(est, se, z, p)
96-
rownames(cm) <- names(est)
97-
colnames(cm) <- c("Estimate", "Std. Error", "z value", "Pr(>|z|)")
95+
coefficients <- cbind(est, se, z, p)
96+
rownames(coefficients) <- names(est)
97+
colnames(coefficients) <- c("Estimate", "Std. Error", "z value", "Pr(>|z|)")
9898

9999
y <- unlist(object[["data"]][, 1], use.names = FALSE)
100100
w <- object[["weights"]]
@@ -109,11 +109,11 @@ summary.felm <- function(
109109

110110
# Generate result list
111111
res <- list(
112-
cm = cm,
113-
nobs = object[["nobs"]],
114-
lvls_k = object[["lvls_k"]],
115-
formula = object[["formula"]],
116-
r.squared = rsq,
112+
coefficients = coefficients,
113+
nobs = object[["nobs"]],
114+
lvls_k = object[["lvls_k"]],
115+
formula = object[["formula"]],
116+
r.squared = rsq,
117117
adj.r.squared = 1 - (1 - rsq) * (n - 1) / (n - k + 1)
118118
)
119119

R/generics_tidy.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ NULL
1818
#' @rdname broom
1919
#' @export
2020
tidy.feglm <- function(x, conf_int = FALSE, conf_level = 0.95, ...) {
21-
res <- summary(x)$cm
21+
res <- summary(x)$coefficients
2222
colnames(res) <- c("estimate", "std.error", "statistic", "p.value")
2323

2424
if (conf_int) {

0 commit comments

Comments
 (0)