rStats.js v1.3.0
    Preparing search index...

    Function survdiff

    • Test of the difference between survival curves: the G-rho family of Harrington and Fleming, the log-rank test for rho = 0. Equivalent to R's survival::survdiff(). As survdiff(Surv(time, status) ~ group, rho = rho).

      Rows with a missing time, status or group are dropped.

      Parameters

      • time: readonly number[]

        Follow-up times.

      • status: readonly number[]

        1 for an event, 0 for a censored time.

      • group: readonly (GroupLabel | null)[]

        Group labels, one per observation.

      • options: SurvdiffOptions = {}

      Returns SurvdiffResult

      const r = survdiff([1, 2, 3, 4, 5, 6], [1, 1, 0, 1, 1, 1], ["a", "b", "a", "b", "a", "b"]);
      r.chisq; // 0.073903
      r.pvalue; // 0.78574