hypr
hypr: An R package for hypothesis-driven contrast coding - Published in JOSS (2020)
Science Score: 100.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 3 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org, zenodo.org -
✓Committers with academic emails
1 of 1 committers (100.0%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Last synced: 6 months ago
·
JSON representation
·
Repository
hypr is an R package for easy translation between experimental (null) hypotheses and contrast matrices as used for linear regression.
Basic Info
Statistics
- Stars: 17
- Watchers: 3
- Forks: 0
- Open Issues: 0
- Releases: 14
Created over 6 years ago
· Last pushed over 2 years ago
Metadata Files
Readme
License
Citation
README.Rmd
---
title: "hypr"
output:
md_document:
variant: markdown_github
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(hypr)
latexImg = function(latex){
paste0(',')')
}
```
# hypr
[](https://cran.r-project.org/package=hypr)
[](https://cran.r-project.org/package=hypr)
[](https://joss.theoj.org/papers/10.21105/joss.02134)
[](https://zenodo.org/badge/latestdoi/208564895)
[](https://github.com/mmrabe/hypr/actions/workflows/r.yml)
hypr is an R package for easy translation between experimental (null) hypotheses and contrast matrices as used for linear regression. For an extensive overview of the package functions, see the `hypr-intro` vignette, e.g. by running `vignette("hypr-intro")` after installing the package.
## Installation
Install from CRAN within R using:
```{r, eval=FALSE}
install.packages("hypr")
```
Install the development version in R using `devtools`:
```{r, eval=FALSE}
devtools::install_github("mmrabe/hypr", build_vignettes = TRUE)
```
## Deriving contrast matrices
For a treatment contrast with a baseline and three treatment conditions:
`r latexImg("H_{0_1}: \\mu_1 = 0")`
`r latexImg("H_{0_2}: \\mu_2 = \\mu_1")`
`r latexImg("H_{0_3}: \\mu_3 = \\mu_1")`
`r latexImg("H_{0_4}: \\mu_4 = \\mu_1")`
```{r}
trtC <- hypr(mu1~0, mu2~mu1, mu3~mu1, mu4~mu1)
trtC
```
To assign the contrast matrix to a factor `fac` with an intermediate hypr object:
```{r, eval=FALSE}
contrasts(fac) <- contr.hypothesis(trtC)
```
... or without an intermediate object:
```{r, eval=FALSE}
contrasts(fac) <- contr.hypothesis(mu1~0, mu2~mu1, mu3~mu1, mu4~mu1)
```
For more information, see `vignette("hypr-regression")`.
## Deriving research hypotheses
To check which reserach (null) hypotheses a given contrast matrix is testing, we can create an empty hypr object.
```{r}
testC <- hypr() # create an empty hypr object
```
A treatment contrast with 4 levels (incl. the baseline) can look as follows:
```{r}
contr.treatment(4)
```
We can now populate the hypr object by setting its contrast matrix. Note that the treatment contrast does not have an intercept. We thus have to add it when populating the hypr object:
```{r}
cmat(testC, add_intercept = TRUE) <- contr.treatment(4) # populate object via contrast matrix
```
Now, the hypr object contains 4 hypotheses, a hypothesis matrix and the contrast matrix identical to the treatment contrast with an intercept added:
```{r}
testC
```
The derived hypotheses can be rewritten as:
`r latexImg("H_{0_1}: \\mu_1 = 0")`
`r latexImg("H_{0_2}: \\mu_2 = \\mu_1")`
`r latexImg("H_{0_3}: \\mu_3 = \\mu_1")`
`r latexImg("H_{0_4}: \\mu_4 = \\mu_1")`
For more information, see `vignette("hypr-contrasts")`.
## Community guidelines
If you want to report a bug, are having technical difficulties or want to recommend features, it’s best to open a [Github Issue](https://github.com/mmrabe/hypr/issues/new/choose). If you want to suggest a specific implementation of a feature or bug fix, you’re welcome to fork the repository and submit a pull request! Alternatively, if you are having problems or questions, you can also send an e-mail ().
Owner
- Name: Maximilian M. Rabe
- Login: mmrabe
- Kind: user
- Location: Copenhagen, Denmark
- Company: University of Copenhagen
- Website: https://maxrabe.com
- Twitter: MaxMRabe
- Repositories: 6
- Profile: https://github.com/mmrabe
Postdoc at the University of Copenhagen, Denmark.
JOSS Publication
hypr: An R package for hypothesis-driven contrast coding
Published
April 27, 2020
Volume 5, Issue 48, Page 2134
Authors
Tags
psychology linguistics linear regression linear model statistics research methods research hypothesesCitation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: Rabe
given-names: Maximilian M.
orcid: https://orcid.org/0000-0002-2556-5644
- family-names: Vasishth
given-names: Shravan
orcid: https://orcid.org/0000-0003-2027-1994
- family-names: Hohenstein
given-names: Sven
orcid: https://orcid.org/0000-0002-9708-1593
- family-names: Kliegl
given-names: Reinhold
orcid: https://orcid.org/0000-0002-0180-8488
- family-names: Schad
given-names: Daniel J.
orcid: https://orcid.org/0000-0003-2586-6823
title: "hypr: An R package for hypothesis-driven contrast coding"
version: 0.2.2
doi: 10.5281/zenodo.3765842
date-released: 2021-08-18
GitHub Events
Total
Last Year
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Maximilian Rabe | m****e@u****e | 155 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 5
- Total pull requests: 0
- Average time to close issues: 7 days
- Average time to close pull requests: N/A
- Total issue authors: 4
- Total pull request authors: 0
- Average comments per issue: 1.6
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- mmrabe (2)
- kathschn (1)
- dmenne (1)
- stfnrpplngr (1)
Pull Request Authors
Top Labels
Issue Labels
enhancement (1)
planned (1)
documentation (1)
