PwrGSD (version 2.3.1)

mysurvfit: My Survfit

Description

Computes numbers at risk, numbers of events at each unique event time within levels of a blocking factor

Usage

mysurvfit(formula = formula(data), data = parent.frame(), subset, na.action = na.fail)

Arguments

formula

Should be a formula of the form Surv(ti, ev) ~ block where block is the blocking factor. It need not be a factor per se but should have relatively few discrete levels. Sorry, no staggered entry allowed at present

data

a dataframe

subset

you can subset the analysis via logical expression in variables in the dataframe

na.action

pass a method for handling NA values in block such as na.omit, or na.fail

Value

A dataframe of 2*NLEV + 1 columns where NLEV is the number of levels of the factor block.

time

The sorted vector of unique event times from all blocks

nrisk1

The number at risk in block level 1 at each event time

nevent1

The number of events in block level 1 at each event time

...

nriskNLEV

The number at risk in block level NLEV at each event time

neventNLEV

The number of events in block level NLEV at each event time

Examples

Run this code
# NOT RUN {
  library(PwrGSD)
  data(lung)

  fit.msf <- mysurvfit(Surv(time, I(status==2)) ~ sex, data=lung)

  fit.msf
  
# }
# NOT RUN {
  plot(fit.msf)
  
# }

Run the code above in your browser using DataCamp Workspace