A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://insightsengineering.github.io/tern/latest-tag/reference/summarize_ancova.html below:

Summarize analysis of covariance (ANCOVA) results — summarize_ancova • tern

The analyze function summarize_ancova() creates a layout element to summarize ANCOVA results.

This function can be used to analyze multiple endpoints and/or multiple timepoints within the response variable(s) specified as vars.

Additional variables for the analysis, namely an arm (grouping) variable and covariate variables, can be defined via the variables argument. See below for more details on how to specify variables. An interaction term can be implemented in the model if needed. The interaction variable that should interact with the arm variable is specified via the interaction_term parameter, and the specific value of interaction_term for which to extract the ANCOVA results via the interaction_y parameter.

Usage
summarize_ancova(
  lyt,
  vars,
  variables,
  conf_level,
  interaction_y = FALSE,
  interaction_item = NULL,
  weights_emmeans = NULL,
  var_labels,
  na_str = default_na_str(),
  nested = TRUE,
  ...,
  show_labels = "visible",
  table_names = vars,
  .stats = c("n", "lsmean", "lsmean_diff", "lsmean_diff_ci", "pval"),
  .stat_names = NULL,
  .formats = NULL,
  .labels = NULL,
  .indent_mods = list(lsmean_diff_ci = 1L, pval = 1L)
)

s_ancova(
  df,
  .var,
  .df_row,
  .ref_group,
  .in_ref_col,
  variables,
  conf_level,
  interaction_y = FALSE,
  interaction_item = NULL,
  weights_emmeans = NULL,
  ...
)

a_ancova(
  df,
  ...,
  .stats = NULL,
  .stat_names = NULL,
  .formats = NULL,
  .labels = NULL,
  .indent_mods = NULL
)
Arguments
lyt

(PreDataTableLayouts)
layout that analyses will be added to.

vars

(character)
variable names for the primary analysis variable to be iterated over.

variables

(named list of string)
list of additional analysis variables, with expected elements:

conf_level

(proportion)
confidence level of the interval.

interaction_y

(string or flag)
a selected item inside of the interaction_item variable which will be used to select the specific ANCOVA results. if the interaction is not needed, the default option is FALSE.

interaction_item

(string or NULL)
name of the variable that should have interactions with arm. if the interaction is not needed, the default option is NULL.

weights_emmeans

(string or NULL)
argument from emmeans::emmeans()

var_labels

(character)
variable labels.

na_str

(string)
string used to replace all NA or empty values in the output.

nested

(flag)
whether this layout instruction should be applied within the existing layout structure _if possible (TRUE, the default) or as a new top-level element (FALSE). Ignored if it would nest a split. underneath analyses, which is not allowed.

...

additional arguments for the lower level functions.

show_labels

(string)
label visibility: one of "default", "visible" and "hidden".

table_names

(character)
this can be customized in the case that the same vars are analyzed multiple times, to avoid warnings from rtables.

.stats

(character)
statistics to select for the table.

Options are: 'n', 'lsmean', 'lsmean_diff', 'lsmean_diff_ci', 'pval'

.stat_names

(character)
names of the statistics that are passed directly to name single statistics (.stats). This option is visible when producing rtables::as_result_df() with make_ard = TRUE.

.formats

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

.labels

(named character)
labels for the statistics (without indent).

.indent_mods

(named integer)
indent modifiers for the labels. Defaults to 0, which corresponds to the unmodified default behavior. Can be negative.

df

(data.frame)
data set containing all analysis variables.

.var

(string)
single variable name that is passed by rtables when requested by a statistics function.

.df_row

(data.frame)
data set that includes all the variables that are called in .var and variables.

.ref_group

(data.frame or vector)
the data corresponding to the reference group.

.in_ref_col

(flag)
TRUE when working with the reference level, FALSE otherwise.

Value Functions Examples
basic_table() %>%
  split_cols_by("Species", ref_group = "setosa") %>%
  add_colcounts() %>%
  summarize_ancova(
    vars = "Petal.Length",
    variables = list(arm = "Species", covariates = NULL),
    table_names = "unadj",
    conf_level = 0.95, var_labels = "Unadjusted comparison",
    .labels = c(lsmean = "Mean", lsmean_diff = "Difference in Means")
  ) %>%
  summarize_ancova(
    vars = "Petal.Length",
    variables = list(arm = "Species", covariates = c("Sepal.Length", "Sepal.Width")),
    table_names = "adj",
    conf_level = 0.95, var_labels = "Adjusted comparison (covariates: Sepal.Length and Sepal.Width)"
  ) %>%
  build_table(iris)
#>                                                                  setosa    versicolor     virginica  
#>                                                                  (N=50)      (N=50)         (N=50)   
#> —————————————————————————————————————————————————————————————————————————————————————————————————————
#> Unadjusted comparison                                                                                
#>   n                                                                50          50             50     
#>   Mean                                                            1.46        4.26           5.55    
#>   Difference in Means                                                         2.80           4.09    
#>     95% CI                                                                (2.63, 2.97)   (3.92, 4.26)
#>     p-value                                                                 <0.0001        <0.0001   
#> Adjusted comparison (covariates: Sepal.Length and Sepal.Width)                                       
#>   n                                                                50          50             50     
#>   Adjusted Mean                                                   2.02        4.19           5.07    
#>   Difference in Adjusted Means                                                2.17           3.05    
#>     95% CI                                                                (1.96, 2.38)   (2.81, 3.29)
#>     p-value                                                                 <0.0001        <0.0001   


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4