`make_table2.Rd`

`make_table2`

and its associated methods are provided to create standard
table 2s based on the supplied results from appropriate estimation routines.
A typical table 2 consist of one row for each treatment group in each results
object. The table contains the number of subjects, total amount of observed
person-time during follow-up, number of events, estimates of interest
(possibly at a specified time point, when applicable), and confidence
interval for the specified coverage level. When there are multiple treatment
groups for a given results object then a typical table 2 also adds a column
providing the specified effect measure and associated confidence interval
comparing a given treatment to the reference group for each row with the
exception of the reference group.

Note that the person-time, events, and rates are computed using all of the
follow-up time and *not* with respect to e.g. `risk_time`

or `count_time`

(as
appropriate).

```
make_table2(obj, ...)
# S3 method for cumrisk
make_table2(
...,
effect_measure_type = "RD",
rate_round = 2,
pt_round = 0,
pt_scale = 1,
risk_round = 1,
risk_time = NULL,
alpha = 0.05,
rate_alpha = 0.05,
ref = 1,
boot_method = "normal",
caption = "",
table_footer = "",
calc_rate_ci = FALSE,
scale_pt_display = TRUE
)
# S3 method for cumcount
make_table2(
...,
effect_measure_type = "CD",
count_round = 1,
count_time = NULL,
alpha = 0.05,
ref = 1,
boot_method = "normal",
caption = "",
table_footer = ""
)
# S3 method for hr
make_table2(..., hr_round = 2, alpha = 0.05, caption = "", table_footer = "")
```

- obj
An object with an associated method for creating table 2s.

- ...
For the

`make_table2`

generic function, arguments to be passed on to the appropriate method. For a given method, any remaining inputs to`...`

should be objects with an associated method for creating table 2s supplied as either as seperate arguments or as a list.- effect_measure_type
A string identifying the type of effect measure to be computed from among the following options for a given method.

`cumrisk`

:`"RD"`

(risk difference),`"RR"`

(risk ratio),`"logRR"`

(logarithm of the risk ratio), or`"AR"`

(attributable risk)`cumcount`

:`"CD"`

(count difference) or`"CR"`

(count ratio)

Note that when a given input results object was created using bootstrap estimation and

`boot_method`

is`"log-normal"`

, then only effect measures with support on the positive real line can be used (i.e.`"RR"`

or`"CR"`

). See the*Cumulative risk effect measure types*and*Cumulative count effect measure types*sections for the definitions of the various effect measures.- rate_round
The number of significant digits used for rounding the rate

- pt_round
The number of significant digits used for rounding person-time

- pt_scale
A scaling factor for the person time (default pt_scale = 1).

- risk_round
The number of significant digits used for rounding the risk

- risk_time
The time at which the cumulative risk estimates should be returned (the default value of

`NULL`

returns all times)- alpha
The desired nominal significance level of the confidence intervals

- rate_alpha
The desired nominal significance level of the confidence intervals for the rate

- ref
The category to use as the reference for effect measure calculations.

- boot_method
The specific bootstrap approach used to compute confidence intervals (default method = "normal" for a normal approximation on the risk scale, other choices include "log-normal" for normal approximation on the log scale). When a given input results object was created without using bootstrap estimation then the value of

`boot_method`

is ignored. Note that when a given input results object was created using bootstrap estimation and`boot_method`

is`"log-normal"`

, then only effect measures specified via`effect_measure_type`

with support on the positive real line can be used.- caption
Text that will be added above the top left of the table, ie a title to the table

- table_footer
Additional footer information accepts html formatting

- calc_rate_ci
Logical that allows user to output confidence intervals for rates in table 2. Defaults to FALSE.

- scale_pt_display
Logical that allows user to turn off pt_scale for person-time but not for rate (default = TRUE)

- count_round
The number of significant digits used for rounding the count

- count_time
The desired time at which to extract the the cumulative count and count difference. If

`NULL`

, uses the median time in the cumcount object.- hr_round
The number of decimal places used for rounding the hazard ratio. Default is 2.

An object of class `c("datatables", "htmlwidget")`

used to display
the results.

`make_table2(cumrisk)`

: Creates a formatted table 2 from supplied`cumrisk`

objects`make_table2(cumcount)`

: Creates a formatted table 2 from supplied`cumcount`

objects`make_table2(hr)`

: Creates a formatted table 2 from supplied`hr`

objects

Mean: \(\mathrm{E}[Y^{1}] - \mathrm{E}[Y^{0}]\)

Variance with IPW: \( \mathrm{Var}[Y^{1}] + \mathrm{Var}[Y^{0}] + \frac{2}{n} \mathrm{E}[Y^{1}] \, \mathrm{E}[Y^{0}] \)

Variance otherwise: \(\mathrm{Var}[Y^{1}] + \mathrm{Var}[Y^{0}]\)

Mean: \(\frac{\mathrm{E}[Y^{1}]}{\mathrm{E}[Y^{0}]}\)

Variance with IPW: \( \frac{\mathrm{Var}[Y^{1}]}{(\mathrm{E}[Y^{0}])^{2}} + \frac{\mathrm{Var}[Y^{0}]\,(\mathrm{E}[Y^{1}])^2} {(\mathrm{E}[Y^{0}])^{4}} + \frac{2\,(\mathrm{E}[Y^{1}])^2}{n\,(\mathrm{E}[Y^{0}])^2} \)

Variance otherwise: \( \frac{\mathrm{Var}[Y^{1}]}{(\mathrm{E}[Y^{0}])^{2}} + \frac{\mathrm{Var}[Y^{0}]\,(\mathrm{E}[Y^{1}])^2} {(\mathrm{E}[Y^{0}])^{4}} \)

Mean: \(\mathrm{log}\frac{\mathrm{E}[Y^{1}]}{\mathrm{E}[Y^{0}]}\)

Variance with IPW: \( \frac{\mathrm{Var}[Y^{1}]}{(\mathrm{E}[Y^{1}])^{2}} + \frac{\mathrm{Var}[Y^{0}]}{(\mathrm{E}[Y^{0}])^{2}} + \frac{2}{n} \)

Variance otherwise: \( \frac{\mathrm{Var}[Y^{1}]}{(\mathrm{E}[Y^{1}])^{2}} + \frac{\mathrm{Var}[Y^{0}]}{(\mathrm{E}[Y^{0}])^{2}} \)

Mean: \(\frac{\mathrm{E}[Y^{1}] - \mathrm{E}[Y^{0}]}{\mathrm{E}[Y^{1}]}\)

Variance with IPW: \( \frac{\mathrm{Var}[Y^{0}]}{(\mathrm{E}[Y^{1}])^{2}} + \frac{\mathrm{Var}[Y^{1}]\,(\mathrm{E}[Y^{0}])^{2}} {(\mathrm{E}[Y^{1}])^{4}} + \frac{2\,(\mathrm{E}[Y^{0}])^{2}}{n\,(\mathrm{E}[Y^{1}])^{2}} \)

Variance otherwise: \( \frac{\mathrm{Var}[Y^{0}]}{(\mathrm{E}[Y^{1}])^{2}} + \frac{\mathrm{Var}[Y^{1}]\,(\mathrm{E}[Y^{0}])^{2}} {(\mathrm{E}[Y^{1}])^{4}} \)

Mean: \(\mathrm{E}[Y^{1}] - \mathrm{E}[Y^{0}]\)

Variance with IPW: \( \mathrm{Var}[Y^{1}] + \mathrm{Var}[Y^{0}] + \frac{2}{n} \mathrm{E}[Y^{1}] \, \mathrm{E}[Y^{0}] \)

Variance otherwise: \(\mathrm{Var}[Y^{1}] + \mathrm{Var}[Y^{0}]\)

Mean: \(\frac{\mathrm{E}[Y^{1}]}{\mathrm{E}[Y^{0}]}\)

Variance with IPW: \( \frac{\mathrm{Var}[Y^{1}]}{(\mathrm{E}[Y^{0}])^{2}} + \frac{\mathrm{Var}[Y^{0}]\,(\mathrm{E}[Y^{1}])^2} {(\mathrm{E}[Y^{0}])^{4}} + \frac{2\,(\mathrm{E}[Y^{1}])^2}{n\,(\mathrm{E}[Y^{0}])^2} \)

Variance otherwise: \( \frac{\mathrm{Var}[Y^{1}]}{(\mathrm{E}[Y^{0}])^{2}} + \frac{\mathrm{Var}[Y^{0}]\,(\mathrm{E}[Y^{1}])^2} {(\mathrm{E}[Y^{0}])^{4}} \)