Skip to content

Conversation

sagebiej
Copy link

@sagebiej sagebiej commented Aug 5, 2025

Summary

This PR adds first‐class support in texreg for models estimated with the apollo package. Specifically:

  1. Extract method

    • Implements extract.apollo(), an S4 method that takes an apollo object (class "apollo" "maxLik" "maxim") and returns a properly populated texreg object.
    • Allows users to switch among normal, robust, or bootstrap standard errors, and optionally accepts a pre‐computed WTP table to display willingness‐to‐pay estimates instead of raw coefficients.
  2. Tests

    • Introduces a new test file tests/testthat/test-extract-apollo.R under tests/.
    • Covers
      • Basic extraction of coefficients, SEs, p‐values, and GOF statistics (num. obs., num. indiv., null & fitted log‐likelihood).
      • Extraction when a wtpest data frame is supplied.
      • Validation that invalid se arguments error out correctly.
    • Uses the built‐in apollo_swissRouteChoiceData for a “tiny MNL” speed test that skips on CRAN and without apollo installed.
  3. Documentation updates

    • Added roxygen-style comments in R/extract.R to document the new extract.apollo() method.
    • Registered the S4 method with setMethod("extract", signature = className("apollo","apollo"), definition = extract.apollo).

Motivation

Users of apollo—a flexible choice-modeling framework—have been unable to generate publication-quality LaTeX tables directly with texreg. This change fills that gap, letting analysts:

model <- apollo_estimate(…)
tr    <- extract(model, se = "rob")
screenreg(tr)

Potential issues/questions

Imports janitor (required as apollo gives sometimes bad names, and apollo (required because to get the table with coefficients, one needs to use the apollo function apollo_modelOutput.

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.

1 participant