summarize_lsmeans_wide {junco}R Documentation

Layout Generating Function for LS Means Wide Table Layouts

Description

Layout Generating Function for LS Means Wide Table Layouts

Usage

summarize_lsmeans_wide(
  lyt,
  variables,
  ref_level,
  treatment_levels,
  conf_level,
  pval_sided = "2",
  include_variance = TRUE,
  include_pval = TRUE,
  formats = list(lsmean = jjcsformat_xx("xx.x"), mse = jjcsformat_xx("xx.x"), df =
    jjcsformat_xx("xx."), lsmean_diff = jjcsformat_xx("xx.x"), se =
    jjcsformat_xx("xx.xx"), ci = jjcsformat_xx("(xx.xx, xx.xx)"), pval =
    jjcsformat_pval_fct(0))
)

Arguments

lyt

empty layout, i.e. result of rtables::basic_table()

variables

(named list of string)
list of additional analysis variables.

ref_level

(string)
the reference level of the treatment arm variable.

treatment_levels

(character)
the non-reference levels of the treatment arm variable.

conf_level

(proportion)
confidence level of the interval.

pval_sided

(string)
either '2' for two-sided or '1' for 1-sided with greater than control or '-1' for 1-sided with smaller than control alternative hypothesis.

include_variance

(flag)
whether to include the variance statistics (M.S. error and d.f.).

include_pval

(flag)
whether to include the p-value column.

formats

(named character or list)
formats for the statistics. See Details in analyze_vars for more information on the 'auto' setting.

Value

Modified layout.

Examples

variables <- list(
  response = "FEV1",
  covariates = c("RACE", "SEX"),
  arm = "ARMCD",
  id = "USUBJID",
  visit = "AVISIT"
)
fit <- fit_ancova(
  vars = variables,
  data = mmrm::fev_data,
  conf_level = 0.9,
  weights_emmeans = "equal"
)
anl <- broom::tidy(fit)
basic_table() |>
  summarize_lsmeans_wide(
    variables = variables,
    ref_level = fit$ref_level,
    treatment_levels = fit$treatment_levels,
    pval_sided = "2",
    conf_level = 0.8
  ) |>
  build_table(df = anl)

[Package junco version 0.1.1 Index]