-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME.Rmd
64 lines (47 loc) · 2.22 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r set-options, echo=FALSE, cache=FALSE}
options(width = 100)
```
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
# MTLR
[![R-CMD-check](https://github.com/haiderstats/MTLR/workflows/R-CMD-check/badge.svg)](https://github.com/haiderstats/MTLR/actions)
[![codecov](https://codecov.io/gh/haiderstats/MTLR/branch/master/graphs/badge.svg)](https://codecov.io/gh/haiderstats/MTLR)
![](http://cranlogs.r-pkg.org/badges/grand-total/MTLR)
The goal of `MTLR` is to provide an R implementation for [Multi-Task Logistic Regression](https://papers.nips.cc/paper/4210-learning-patient-specific-cancer-survival-distributions-as-a-sequence-of-dependent-regressors). In addition to supplying the model provided by [Yu et al.](https://papers.nips.cc/paper/4210-learning-patient-specific-cancer-survival-distributions-as-a-sequence-of-dependent-regressors) we have extended the model for left censoring, interval censoring, and a mixture of censoring types. Functionality includes training an MTLR model, predicting survival curves for new observations, and plotting these survival curves and feature weights estimated by MTLR.
## Installation
You can install the version from CRAN or the development version from GitHub:
```{r, eval = FALSE}
# CRAN:
install.packages("MTLR")
# GitHub:
# install.packages("devtools")
devtools::install_github("haiderstats/MTLR")
```
## Example
Given a survival dataset containing event time and event status indicator (censored/uncensored), we can produce an MTLR model. For example, consider the `lung` dataset from the `survival` package:
```{r include=FALSE}
library(MTLR)
```
```{r example, fig.align='center'}
# Load survival for the lung dataset and the Surv() function.
library(survival)
#Here we will use 9 intervals (10 time points) just for plotting purposes.
#The default is sqrt the number of observations.
mod <- mtlr(Surv(time,status)~., data = lung, nintervals = 9)
print(mod)
#Plot feature weights:
plot(mod)
#Get survival curves for the lung dataset:
curves <- predict(mod)
#Plot the first 20 survival curves:
plotcurves(curves, 1:20)
```