MinMaxLines: Transform the simulation object to include only the min and...

Description Usage Arguments Examples

View source: R/MinMaxLines.R

Description

MinMaxLines is an internal function to transform the simulation object to include only the min and max of the intervals set by ci in the coxsim command, as well as the lower and upper bounds of the middle 50 percent of these intervals. It also returns the medians.

Usage

1
MinMaxLines(df, byVars = "Xj", hr = FALSE, strata = FALSE, clean = FALSE)

Arguments

df

a data frame or a simulation class object.

byVars

character vector of the variables to subset the data frame by. The default is 'Xj'.

hr

logical indicating whether or not df contains a hazard rate.

strata

logical indicating whether or not df contains a stratified hazard rate.

clean

logical, whether or not to clean up the output data frame to only include byVars, Min_CI, Lower50_CI, median, Upper50_CI, Max_CI.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Load Carpenter (2002) data
data("CarpenterFdaData")

# Load survival package
library(survival)

# Run basic model
M1 <- coxph(Surv(acttime, censor) ~ prevgenx + lethal +
           deathrt1 + acutediz + hosp01  + hhosleng +
           mandiz01 + femdiz01 + peddiz01 + orphdum +
           vandavg3 + wpnoavg3 + condavg3 + orderent +
           stafcder, data = CarpenterFdaData)

 # Simulate Hazard Ratios
 Sim1 <- coxsimLinear(M1, b = "stafcder",
                      Xj = c(1237, 1600),
                      Xl = c(1000, 1000),
                      qi = "Hazard Ratio",
                      spin = TRUE, ci = 0.99)

# Find summary statistics of the constricted interval
Sum <- MinMaxLines(Sim1, clean = TRUE)

simPH documentation built on Jan. 13, 2021, 6:52 a.m.