-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
71 lines (50 loc) · 2.72 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# gestage
<!-- badges: start -->
[![R-CMD-check](https://github.com/ki-tools/gestage/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ki-tools/gestage/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/ki-tools/gestage/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ki-tools/gestage?branch=main)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
<!-- badges: end -->
The `gestage` R package implements methods described in [this paper](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8438948/) to estimate gestational age. Currently only models C and D are implemented. These are the simplest models, requiring the fewest number of inputs, yet they perform as well or nearly as well as the more complex models based on harder-to-capture inputs. You can choose between these models based on what measurements you have available. Model C is preferable to Model D in terms of performance.
## Installation
You can install `gestage` from [GitHub](https://github.com/) with:
``` r
# install.packages("remotes")
remotes::install_github("ki-tools/gestage")
```
## Example
Model C takes as input gestational age at birth based on last menstrual period (LMP), `gagelmp`, and birth weight, `birthwt`. We can provide values or vectors values of these variables to a function `gestage_c()`.
```{r example_c}
library(gestage)
# predict GA for one set of predictors:
gestage_c(gagelmp = 250, birthwt = 2800)
# predict GA for different values of gagelmp and specific birthwt
gestage_c(gagelmp = seq(200, 300, by = 10), birthwt = 2800)
# predict GA for different values of birthwt and specific gagelmp
gestage_c(gagelmp = 250, birthwt = seq(2000, 3500, by = 100))
# predict GA for different combinations of gagelmp and birthwt
gestage_c(gagelmp = c(170, 340), birthwt = c(2000, 4000))
```
Model D takes as input head circumference at birth in centimeters, `birthhc`, and birth weight, `birthwt`.
```{r example_d}
library(gestage)
# predict GA for one set of predictors:
gestage_d(birthhc = 30, birthwt = 2800)
# predict GA for different values of birthhc and specific birthwt
gestage_d(birthhc = seq(30, 35, by = 0.2), birthwt = 2800)
# predict GA for different values of birthwt and specific birthhc
gestage_d(birthhc = 30, birthwt = seq(2000, 3500, by = 100))
# predict GA for different combinations of birthhc and birthwt
gestage_d(birthhc = c(30, 35), birthwt = c(2000, 4000))
```