Skip to content

Commit

Permalink
Merge pull request #64 from sl-eeper/master
Browse files Browse the repository at this point in the history
edit vignette
  • Loading branch information
jinseob2kim authored Dec 13, 2024
2 parents 98c725d + 2aff60c commit d3c688e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
8 changes: 5 additions & 3 deletions vignettes/jstable_competing_risk_analysis.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ library(survival)
library(dplyr)
```

# Display results of comepting risk analysis using jstable(Fine-Gray Method)
## Display results of comepting risk analysis using jstable(Fine-Gray Method)

## TableSubgroupMultiCox
- When using the TableSubgroupMultiCox function, preprocessing the data with the finegray function from the survival package is required. The finegray function generates a new dataset containing fgstart, fgstop, fgstatus, and fgwt. The TableSubgroupMultiCox function then displays results based on the corresponding formula and weights.

### When using the TableSubgroupMultiCox function, preprocessing the data with the finegray function from the survival package is required. The finegray function generates a new dataset containing fgstart, fgstop, fgstatus, and fgwt. The TableSubgroupMultiCox function then displays results based on the corresponding formula and weights.
```{r}
data <- mgus2
data$etime <- with(data, ifelse(pstat == 0, futime, ptime))
Expand All @@ -39,7 +40,8 @@ TableSubgroupMultiCox(formula = Surv(fgstart, fgstop, fgstatus) ~ sex, data = pd
```

## cox2.display
- As written above, preprocessing the data with finegray function is also required. By using corresponding formula and weights, cox2.display function will display table results.

### As written above, preprocessing the data with finegray function is also required. By using corresponding formula and weights, cox2.display function will display table results.
```{r}
fgfit <- coxph(Surv(fgstart, fgstop, fgstatus) ~ age + sex,
weight = fgwt, data = pdata, model = T
Expand Down
23 changes: 15 additions & 8 deletions vignettes/jstable_options.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ library(survival)
library(dplyr)
```

# Introducing count_by, event options in TableSubgroupMultiCox
## Introducing count_by, event options in TableSubgroupMultiCox

## TableSubgroupMultiCox

Expand Down Expand Up @@ -52,36 +52,42 @@ lung.label <- lung.label %>%
```

## Counting the Number of Independent Variables for Comparison
- The default option for count_by is set to NULL. By specifying an independent variable in the count_by option, the table will display the counts for each level of the independent variable.

### The default option for count_by is set to NULL. By specifying an independent variable in the count_by option, the table will display the counts for each level of the independent variable.
```{r}
TableSubgroupMultiCox(Surv(time, status) ~ sex, var_subgroups = c("kk", "kk1"), data = lung, time_eventrate = 100, line = TRUE, cluster = "inst", strata = "inst", weights = "age", event = FALSE, count_by = "sex", labeldata = lung.label)
```

## Calculate crude incidence rate of event
- The default value for the event option is set to FALSE. By setting event to TRUE, the table will display the crude incidence rate of events. This rate is calculated using the number of events as the numerator and the count of the independent variable as the denominator.(Different from Kaplan-Meier Estimates)

### The default value for the event option is set to FALSE. By setting event to TRUE, the table will display the crude incidence rate of events. This rate is calculated using the number of events as the numerator and the count of the independent variable as the denominator.(Different from Kaplan-Meier Estimates)
```{r}
TableSubgroupMultiCox(Surv(time, status) ~ sex, var_subgroups = c("kk", "kk1"), data = lung, time_eventrate = 100, line = TRUE, cluster = "inst", strata = "inst", weights = "age", event = TRUE, count_by = "sex", labeldata = lung.label)
```

## Using both count_by and event option is also available
- By using both count_by and event option, the table will display crude incidence rate and the counts for each level of the independant variable.

### By using both count_by and event option, the table will display crude incidence rate and the counts for each level of the independant variable.
```{r}
TableSubgroupMultiCox(Surv(time, status) ~ sex, var_subgroups = c("kk", "kk1"), data = lung, time_eventrate = 100, line = TRUE, cluster = "inst", strata = "inst", weights = "age", event = TRUE, count_by = NULL, labeldata = lung.label)
```
# Introducing pairwise option

## Introducing pairwise, pairwise.showtest option in CreateTableOneJS
- The default value for the pairwise option is FALSE. By setting pairwise to TRUE, the table will display p-values for pairwise comparisons of stratified groups.

### The default value for the pairwise option is FALSE. By setting pairwise to TRUE, the table will display p-values for pairwise comparisons of stratified groups.
```{r}
CreateTableOneJS(vars = names(lung), strata = "ph.ecog", data = lung, showAllLevels = F, labeldata = lung.label, Labels = T, pairwise = T)
```
- By setting pairwise.showtest option to TRUE, the table will display test used to calculate p-values for pairwise comparisons of stratified groups. Default test for categorical variables are chi-sq test and continuous variables are t-test.

### By setting pairwise.showtest option to TRUE, the table will display test used to calculate p-values for pairwise comparisons of stratified groups. Default test for categorical variables are chi-sq test and continuous variables are t-test.
```{r}
CreateTableOneJS(vars = names(lung), strata = "ph.ecog", data = lung, showAllLevels = F, labeldata = lung.label, Labels = T, pairwise = T, pairwise.showtest = T)
```

## Introducing pairwise option in svyCreateTableOneJS
- The default value for the pairwise option is FALSE. By setting pairwise to TRUE, the table will display p-values for pairwise comparisons of stratified groups.

### The default value for the pairwise option is FALSE. By setting pairwise to TRUE, the table will display p-values for pairwise comparisons of stratified groups.
```{r}
library(survey)
data(nhanes)
Expand All @@ -104,7 +110,8 @@ svyCreateTableOneJS(
strata = "race", data = nhanesSvy, factorVars = c("HI_CHOL", "race", "RIAGENDR"), labeldata = a.label, Labels = T, pairwise = T
)
```
- By setting pairwise.showtest option to TRUE, the table will display test used to calculate p-values for pairwise comparisons of stratified groups.

### By setting pairwise.showtest option to TRUE, the table will display test used to calculate p-values for pairwise comparisons of stratified groups.
```{r}
svyCreateTableOneJS(
vars = c("HI_CHOL", "race", "agecat", "RIAGENDR"),
Expand Down

0 comments on commit d3c688e

Please sign in to comment.