tenFHcorr | R Documentation |

Correlations can be used with `mvtnorm::pmvnorm`

to compute
p-value for MaxCombo, the maximum of the specifed
Fleming-Harrington tests

```
tenFHcorr(
x = sim_pw_surv(n = 200) %>% cut_data_by_event(100) %>% counting_process(arm =
"Experimental"),
rg = tibble(rho = c(0, 0, 1, 1), gamma = c(0, 1, 0, 1)),
corr = TRUE
)
```

`x` |
a |

`rg` |
a |

`corr` |
a logical; if TRUE (default), return correlation matrix; otherwise, return covariance matrix |

a `tibble`

with `rg`

as input, the FH test statistics specified
for the data in `Z`

, and the correlation or covariance matrix for these tests in variables starting
with `V`

```
library(tidyr)
library(dplyr)
# Use default enrollment and event rates at cut of 100 events
x <- sim_pw_surv(n = 200) %>%
cut_data_by_event(100) %>%
counting_process(arm = "Experimental")
# compute logrank (FH(0,0)) and FH(0,1)
x <- x %>% tenFHcorr(rg = tibble(rho = c(0, 0),
gamma = c(0, 1)))
# compute p-value for MaxCombo
library(mvtnorm)
1 - pmvnorm(lower = rep(min(x$Z), nrow(x)),
corr = data.matrix(select(x, -c(rho, gamma, Z))),
algorithm = GenzBretz(maxpts = 50000, abseps = 0.00001))[1]
# check that covariance is as expected
x <- sim_pw_surv(n = 200) %>%
cut_data_by_event(100) %>%
counting_process(arm = "Experimental")
x %>% tenFHcorr(rg = tibble(rho = c(0, 0),
gamma = c(0, 1)),
corr = FALSE)
# Off-diagonal element should be variance in following
x %>% tenFHcorr(rg = tibble(rho = 0,
gamma =.5),
corr = FALSE)
# compare off diagonal result with wlr()
x %>% wlr(rg = tibble(rho = 0, gamma =.5))
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.