Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.0%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: mgoplerud
  • Language: R
  • Default Branch: main
  • Size: 485 KB
Statistics
  • Stars: 5
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Created almost 4 years ago · Last pushed over 1 year ago
Metadata Files
Readme

README.md

FactorHet R-CMD-check codecov

This package estimates heterogeneous effects in factorial and conjoint experiments. Its details are fully described in Goplerud, Imai, and Pashley (2025): "Estimating Heterogeneous Causal Effects of High-Dimensional Treatments: Application to Conjoint Analysis".

The core method is a Bayesian regularized finite mixture-of-experts where moderators can affect an individual's probability of cluster membership and a sparsity-inducing prior fuses together levels of each factor in each cluster while respecting ANOVA-style sum-to-zero constraints described in Egami and Imai (2019). The posterior mode is found using an AECM algorithm with a number of techniques to accelerate convergence. Approximate quantification of uncertainty is provided by examining the Hessian of the log-posterior. Additional details are explained in the paper and (briefly) in the package documentation.

It can be installed from CRAN or the most-to-update version can be installed using devtools. Note, macOS users may need to ensure that XQuartz is installed; please see information from CRAN (here) for more details.

```

CRAN

install.packages("FactorHet")

Up-to-Date GitHub Version

library(devtools) devtools::install_github('mgoplerud/FactorHet') ```

There are two key functions for estimating the model: In most cases, one will prefer to use the FactorHet_mbo function to jointly (i) estimate the amount of regularization by minimizing a criterion such as the BIC using model-based optimization and (ii) estimate the final model. However, if one has a specific value of lambda of interest, one can fit the model for a fixed amount of regularization using FactorHet. A simple example is shown below:

fit_FH <- FactorHet_mbo( formula = y ~ factor_1 + factor_2 + factor_1 : factor_2, design = design, moderator = ~ moderator_1 + moderator_2) In the case of repeated observations, the individual is specified via group and the task identifier is specified via task. In the case of a conjoint experiment, the profile identifier (i.e. "left" or "right") is specified via choice_order. An example is shown below:

fit_FH <- FactorHet_mbo( formula = y ~ factor_1 + factor_2 + factor_1 : factor_2, design = design, moderator = ~ moderator_1 + moderator_2, group = ~ id, task = ~ task, choice_order = ~ choice_left)

Finally, after fitting the model, there are functions to calculate the Average Marginal Effect (AME) and related concepts (e.g. ACE, AMIE). A simple example is shown below:

AME(fit_FH)

The effects of moderators on cluster membership can be analyzed using two key functions; first, posterior_by_moderators shows the estimated distribution of (posterior) cluster membership probabilities by covariates. Second, margeff_moderators shows the change in the prior cluster membership as one moderator changes, averaging across all other moderators. This is similar to a marginal effect in a multinomial logistic regression. Example code is shown below:

posterior_by_moderators(fit_FH) margeff_moderators(fit_FH)

Some function names (e.g., AME and margeff_moderators) have been changed for clarity from an older verison of those package. Those functions should still run but will throw a warning and should be updated in existing code.

Owner

  • Login: mgoplerud
  • Kind: user

GitHub Events

Total
  • Watch event: 1
  • Push event: 12
  • Pull request event: 2
  • Create event: 1
Last Year
  • Watch event: 1
  • Push event: 12
  • Pull request event: 2
  • Create event: 1

Packages

  • Total packages: 1
  • Total downloads:
    • cran 482 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
cran.r-project.org: FactorHet

Estimate Heterogeneous Effects in Factorial Experiments Using Grouping and Sparsity

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 482 Last month
Rankings
Forks count: 21.7%
Stargazers count: 27.0%
Dependent packages count: 27.4%
Dependent repos count: 33.8%
Average: 39.4%
Downloads: 87.0%
Maintainers (1)
Last synced: 10 months ago

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/upload-artifact main composite
  • r-lib/actions/setup-pandoc master composite
  • r-lib/actions/setup-r master composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-r v1 composite
  • r-lib/actions/setup-r-dependencies v1 composite
DESCRIPTION cran
  • R >= 3.4.0 depends
  • Matrix * imports
  • ParamHelpers * imports
  • Rcpp >= 1.0.1 imports
  • RcppEigen >= 0.3.3.4.0 imports
  • dplyr * imports
  • ggplot2 * imports
  • methods * imports
  • mlr * imports
  • mlrMBO * imports
  • reshape2 * imports
  • rlang * imports
  • smoof * imports
  • tictoc * imports
  • FNN * suggests
  • RSpectra * suggests
  • mclust * suggests
  • testthat * suggests
  • tgp * suggests