loglinHR {interactionRCS}R Documentation

Linear interaction HR

Description

Generate HR values for a 1 unit increase in a variable at specified points of another interacting variable in a simple Cox interaction model

Usage

loglinHR(
  var2values,
  model,
  data,
  var1,
  var2,
  ci = TRUE,
  conf = 0.95,
  ci.method = "delta",
  ci.boot.method = "perc",
  R = 100,
  parallel = "multicore",
  ...
)

Arguments

var2values

numeric vector of var2 points to estimate

model

model of class coxph or cph. If data is NULL, the function expects to find the data in model$x

data

data used in the model. If absent, it will attempt to recover the data from the model object. Only used for bootstrap CI

var1

variable that increases by 1 unit from 0

var2

variable to spline. var2values belong to var2

ci

calculate 95% CI?

conf

confidence level. Default 0.95

ci.method

confidence interval method. "delta" performs delta method. "bootstrap" performs bootstrapped CI (slower)

ci.boot.method

one of the available bootstrap CI methods from boot.ci. Default percentile

R

number of bootstrap samples if ci.method = "bootstrap". Default 100

parallel

can take values "no", "multicore", "snow" if ci.method = "bootstrap". Default multicore

...

other parameters for boot

Value

if ci = FALSE, a vector of estimate of length(var2values), if ci = TRUE a dataframe with 5 columns, initial values, HR, lower CI, upper CI and SE

Examples

library(survival)
data(cancer)
myformula <- Surv(time, status) ~ ph.karno + ph.ecog + age*sex
model <- coxph(myformula , data = lung )
loglinHR( var2values = 40:80
                     , model = model , data = lung , var1 ="sex", var2="age"
                     , ci=TRUE , conf = 0.95 , ci.method = "delta")

[Package interactionRCS version 0.1.1 Index]