-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
58 lines (39 loc) · 2.44 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
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
options(max.print = 100)
```
# ALARM
<!-- badges: start -->
<!-- badges: end -->
The `{ALARM}` package provides a single primary function, `predictALARM()` to predict the absolute risk of lung cancer mortality based on a set of covariates and a chosen time horizon.
The models used to make predictions are based on the following study ([link](https://www.medrxiv.org/content/10.1101/2022.04.22.22274185v1)):
> Warkentin MT, Tammemägi MC, Espin-Garcia O, Budhathoki S, Liu G, Hung RJ. Asian Lung Cancer Absolute Risk Models for lung cancer mortality based on China Kadoorie Biobank. medRxiv. 2022 July 01.
## Installation
You can install the development version of `ALARM` from GitHub using:
```{r installation, eval=FALSE}
remotes::install_github('mattwarkentin/ALARM')
```
## Usage
Once the package has been installed, we can load the package and make predictions for the absolute risk of lung cancer mortality by supplying a `data.frame` with the requisite covariates and a time horizon to `predictALARM()`.
In this example, we will create some example data for two individuals, one ever-smoker and one never-smoker, with similar covariate values, with the exception of smoking history which are set to missing (`NA`) for the never-smoker. Please see `?validate_data` for more details on the expected format of the input data.
```{r example-data}
library(ALARM)
data <- data.frame(age = 70, sex = 1, fhx_cancer = 1,
phx_cancer = 0, fev1fvc = 70, phx_lungdx = 1,
hhinc = 3, bmi = 30,
smk_status = c(1, 2), smk_duration = c(NA, 40),
smk_cigpday = c(NA, 20))
```
Next, we use the `predictALARM()` function to estimate the absolute risk of lung cancer mortality for a given time horizon, *t* (e.g., `time = 5`).
```{r example-prediction}
predictALARM(data, time = 5)
```
`predictALARM()` returns a `data.frame` that contains all of the columns from the input `data`, with the addition of a new column, `ALARM_pred`, which contains the lung cancer mortality absolute risk estimates at the chosen time horizon and conditional on the subjects' covariates.
## Code of Conduct
Please note that the ALARM project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.