hypothesize is now on CRAN.
What It Does
hypothesize provides a consistent API for hypothesis testing in R. It defines generic methods that any hypothesis test can implement:
pval()- Extract the p-valuetest_stat()- Get the test statisticdof()- Retrieve degrees of freedomis_significant_at()- Check significance at a given level
The package ships with two implementations:
- Likelihood Ratio Test (LRT) for comparing nested models
- Wald Test for testing parameter estimates
Why
When building statistical libraries, I kept implementing ad-hoc hypothesis test structures. Different packages, different interfaces, no composability. hypothesize standardizes this: any package can wrap its tests in a consistent interface, and statistical workflows can treat all tests uniformly.
It’s a small package. That’s the point.
Installation
install.packages("hypothesize")
Quick Example
library(hypothesize)
# Likelihood Ratio Test
result <- lrt(null_loglik = -100, alt_loglik = -96, dof = 3)
print(result)
# Check significance
is_significant_at(result, 0.05)
# Extract components
pval(result)
test_stat(result)
Documentation
Full documentation is at queelius.github.io/hypothesize.
What’s Next
I have several other R packages in the pipeline for CRAN submission, including packages for likelihood-based inference and reliability analysis.
Links
- CRAN: CRAN.R-project.org/package=hypothesize
- GitHub: github.com/queelius/hypothesize
- Documentation: queelius.github.io/hypothesize
Discussion