Implements multi-factor curve analysis for grouped data in 'R', replicating and
extending the functionality of the the 'Stata' ado 'mfcurve' (Krähmer, 2023) < https://ideas.repec.org/c/boc/bocode/s459224.html>.
Related to the idea of specification curve analysis (Simonsohn, Simmons, and Nelson, 2020)
mfcurve is an R package designed for plotting results from multifactorial research designs (i.e. conjoint analyses, choice experiments, factorial survey experiments), replicating and enhancing the functionality of the Stata mfcurve ado file by Daniel Krähmer. The package provides a streamlined workflow for:
This package is ideal for researchers and analysts working with factorial survey experiments, conjoint analysis, or other multi-factor designs.
To install the package from GitHub, follow these steps:
# Install devtools if not already installed
install.packages("devtools")
# Install mfcurve package from GitHub
devtools::install_github("XAM12/mfcurve_R")
Here’s a quick guide on how to use mfcurve:
library(mfcurve)
# Example dataset
data <- data.frame(
outcome = rnorm(100),
factor1 = factor(sample(letters[1:3], 100, replace = TRUE)),
factor2 = factor(sample(letters[4:5], 100, replace = TRUE))
)
# Preprocess data with two factors
preprocessed_data <- mfcurve_preprocessing(data, outcome = "outcome", factors = c("factor1","factor2"))
plot <- mfcurve_plotting(
group_stats_vis = preprocessed_data$group_stats_vis,
lower_data = preprocessed_data$lower_data,
grand_mean = preprocessed_data$grand_mean,
outcome = "outcome",
factors = c("factor1","factor2"),
level = preprocessed_data$level
)
print(plot)
Detailed documentation for each function is available within R:
?mfcurve
?mfcurve_plotting
?mfcurve_preprocessing
For a comprehensive guide on using mfcurve, refer to the vignette:
vignette("mfcurve-intro")
Contributions are welcome! If you find bugs or have suggestions, feel free to open an issue or submit a pull request on GitHub.
This package is licensed under GNU General Public License v3.0 or later. See the LICENSE on GitHub for more details: https://github.com/XAM12/mfcurve_R/blob/main/LICENSE.md
For questions or suggestions, please contact: