-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
59 lines (46 loc) · 1.49 KB
/
README.Rmd
File metadata and controls
59 lines (46 loc) · 1.49 KB
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
---
<!-- 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%"
)
```
# IntCens
The `IntCens` package provides non- and semi-parametric methods for analyzing interval-censored data. This includes iterative estimation routines for proportional hazards and proportional odds models, as well as nonparametric maximum likelihood estimation.
## Installation
You can install the development version of IntCens from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("lmaowisc/IntCens")
```
## Example
The main function for fitting nonparametric, PH, and PO models is `icsurvfit()`.
Below is a basic example:
```{r example}
library(IntCens)
## basic example code
# A dataset containing interval-censored observations and a treatment indicator
# (radiation vs. radiation plus chemotherapy)
data(bcos)
n <- nrow(bcos) # sample size
# Extract the left and right endpoints of the intervals
set.seed(123)
L <- bcos$left + rnorm(n, 0, 0.0001) # add random noise
R <- bcos$right + rnorm(n, 0, 0.0001)
# Covariate (binary)
Z <- as.numeric(bcos$treatment == "RadChem")
# Nonparametric
obj_np <- icsurvfit(L, R)
plot(obj_np, main = "Nonparametric")
# Cox model (PH)
obj_ph <- icsurvfit(L, R, Z, model = "PH")
obj_ph
# Proportional odds model (PO)
obj_po <- icsurvfit(L, R, Z, model = "PO")
obj_po
```