Learn R Programming

simPH (version 1.3.13)

MinMaxLines: Transform the simulation object to include only the min and max of the constricted intervals, as well as the lower and upper bounds of the middle 50 percent of the constricted intervals

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

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

Run this code
# NOT RUN {
# 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)

# }

Run the code above in your browser using DataLab