survatr
  1. Reference
  2. print.survatr_result
  • Home
  • Getting started
    • Introduction
  • Estimation methods
    • IPW (Track A)
    • ICE / longitudinal (Track B)
    • Competing risks (CIF)
  • Reference
    • contrast
    • contrast.survatr_fit
    • forrest
    • forrest.survatr_result
    • plot.survatr_result
    • print.survatr_fit
    • print.survatr_result
    • surv_fit
    • tidy
    • tidy.survatr_result
  • News
  • License
  • Citation

On this page

  • Print a survatr_result
    • Description
    • Usage
    • Arguments
    • Value
    • See Also
    • Examples

Code Links

  1. Reference
  2. print.survatr_result

Print a survatr_result

Description

Minimal banner + head of the result’s contrasts (or estimates for curve-only types). A polished print + plot / tidy / forrest surface ships with the S3 polish in a later chunk.

Usage

## S3 method for class 'survatr_result'
print(x, n = 10L, ...)

Arguments

x A survatr_result.
n Maximum number of rows from the contrasts / estimates table to show (default 10).
… Unused.

Value

The result object, invisibly.

See Also

Other survatr_result methods: contrast(), contrast.survatr_fit(), forrest(), forrest.survatr_result(), plot.survatr_result(), tidy.survatr_result()

Examples

library("survatr")

set.seed(2)
n_id <- 40L
K <- 5L
pp <- data.frame(
  id = rep(seq_len(n_id), each = K),
  t = rep(seq_len(K), times = n_id),
  A = rep(rbinom(n_id, 1L, 0.5), each = K),
  Y = rbinom(n_id * K, 1L, 0.1)
)
fit <- surv_fit(pp, "Y", "A", ~1, "id", "t", time_formula = ~ factor(t))
res <- contrast(
  fit,
  interventions = list(a1 = causatr::static(1), a0 = causatr::static(0)),
  times = 1:5,
  type = "risk_difference"
)
print(res)
<survatr_result>
  Type:        risk_difference
  Reference:   a1
  CI method:   none
  Time grid:   [1, 5] (5 unique times)
  Estimates:   10 rows
  Contrasts:   5 rows

   contrast  time    estimate    se ci_lower ci_upper
     <char> <int>       <num> <num>    <num>    <num>
1: a0 vs a1     1 -0.07544723    NA       NA       NA
2: a0 vs a1     2 -0.14864586    NA       NA       NA
3: a0 vs a1     3 -0.19989649    NA       NA       NA
4: a0 vs a1     4 -0.21851107    NA       NA       NA
5: a0 vs a1     5 -0.21851107    NA       NA       NA