risks

risks: R package for estimating risk ratios and risk differences using regression

https://github.com/stopsack/risks

Science Score: 10.0%

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

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: pubmed.ncbi, ncbi.nlm.nih.gov
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.4%) to scientific vocabulary

Keywords

binomial biostatistics epidemiology regression-models
Last synced: 5 months ago · JSON representation

Repository

risks: R package for estimating risk ratios and risk differences using regression

Basic Info
Statistics
  • Stars: 6
  • Watchers: 1
  • Forks: 1
  • Open Issues: 5
  • Releases: 1
Topics
binomial biostatistics epidemiology regression-models
Created almost 6 years ago · Last pushed 9 months ago
Metadata Files
Readme License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# risks: Estimating risk ratios and risk differences using regression


  [![Codecov test coverage](https://codecov.io/gh/stopsack/risks/branch/master/graph/badge.svg)](https://codecov.io/gh/stopsack/risks?branch=master)
  [![R CMD CHECK](https://github.com/stopsack/risks/actions/workflows/main.yml/badge.svg)](https://github.com/stopsack/risks/actions/workflows/main.yml)


## Installation

The **risks** package can be installed from CRAN:

```{r, eval = FALSE}
install.packages("risks")
```

Development versions can be installed from 
[GitHub](https://stopsack.github.io/risks/) using:

```{r, eval = FALSE}
remotes::install_github("stopsack/risks")
```

## Summary

The **risks** package fits regression models for risk ratios (RR) and risk
differences (RD). The package refers to “risk,” but “prevalence” can be
substituted throughout.

What is the association between an exposure (smoker/nonsmoker, age in years, or
underweight/lean/overweight/obese) and the risk of a binary outcome
(dead/alive, disease/healthy), perhaps adjusting for confounders
(men/women, years of education)? For such questions, many
studies default to reporting odds ratios, which may exaggerate 
associations when the outcome is common. Odds ratios are often used because they
are easily obtained from logistic regression models. Obtaining risk ratios or
risk differences, especially adjusting for confounders, has typically required
more advanced biostatistics and programming skills, including in R.

The **risks** package makes estimating adjusted risk ratios and risk differences 
as simple as fitting a logistic regression model. No advanced programming or
biostatistics skills are required. Risk ratios or risk differences are returned
whenever the data would allow for fitting a logistic model.


## Basic example

The example data stem from a [cohort of women with breast cancer](https://pubmed.ncbi.nlm.nih.gov/15286014). The the categorical exposure is `stage`, the binary outcome is `death`, and the binary confounder is `receptor`.

Fit a risk difference model:

```{r basic_example}
library(risks)  # provides riskratio(), riskdiff(), postestimation functions
fit <- riskdiff(formula = death ~ stage + receptor, data = breastcancer)
```

Fitted objects can be used in the usual commands for generalized linear models, such as:

```{r basic_example2}
summary(fit)
```

`tidy()` from the broom package provides easy access to coefficients:

```{r basic_example3}
broom::tidy(fit)
```


## Further reading

-   [Get started with the **risks** package](https://stopsack.github.io/risks/articles/risks.html)
-   [Models and model comparisons](https://stopsack.github.io/risks/articles/models.html)
-   [More on marginal standardization](https://stopsack.github.io/risks/articles/margstd.html)
-   [Reporting results with the **rifttable** package](https://stopsack.github.io/rifttable/)

Owner

  • Name: Konrad H. Stopsack
  • Login: stopsack
  • Kind: user
  • Location: Boston, MA
  • Company: Massachusetts General Hospital

Epidemiologist

GitHub Events

Total
  • Watch event: 1
  • Delete event: 2
  • Push event: 6
  • Pull request event: 2
Last Year
  • Watch event: 1
  • Delete event: 2
  • Push event: 6
  • Pull request event: 2

Packages

  • Total packages: 1
  • Total downloads:
    • cran 590 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 2
  • Total maintainers: 1
cran.r-project.org: risks

Estimate Risk Ratios and Risk Differences using Regression

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 590 Last month
Rankings
Forks count: 21.0%
Dependent repos count: 24.0%
Stargazers count: 25.5%
Dependent packages count: 28.8%
Average: 30.6%
Downloads: 53.9%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • addreg * imports
  • bcaboot * imports
  • boot * imports
  • broom * imports
  • dplyr * imports
  • lifecycle * imports
  • logbin * imports
  • purrr * imports
  • rlang * imports
  • sandwich * imports
  • stats * imports
  • tibble * imports
  • tidyr * imports
  • MASS * suggests
  • covr * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • testthat * suggests
.github/workflows/main.yml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc HEAD composite
  • r-lib/actions/setup-r HEAD composite
.github/workflows/pkgdown.yaml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc HEAD composite
  • r-lib/actions/setup-r HEAD composite