View source: R/summarize_ancova.R
| summarize_ancova | R Documentation |
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.
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
)
lyt |
( |
vars |
( |
variables |
(named
|
conf_level |
( |
interaction_y |
( |
interaction_item |
( |
weights_emmeans |
( |
var_labels |
( |
na_str |
( |
nested |
( |
... |
additional arguments for the lower level functions. |
show_labels |
( |
table_names |
( |
.stats |
( Options are: |
.stat_names |
( |
.formats |
(named |
.labels |
(named |
.indent_mods |
(named |
df |
( |
.var |
( |
.df_row |
( |
.ref_group |
( |
.in_ref_col |
( |
summarize_ancova() returns a layout object suitable for passing to further layouting functions,
or to rtables::build_table(). Adding this function to an rtable layout will add formatted rows containing
the statistics from s_ancova() to the table layout.
s_ancova() returns a named list of 5 statistics:
n: Count of complete sample size for the group.
lsmean: Estimated marginal means in the group.
lsmean_diff: Difference in estimated marginal means in comparison to the reference group.
If working with the reference group, this will be empty.
lsmean_diff_ci: Confidence level for difference in estimated marginal means in comparison
to the reference group.
pval: p-value (not adjusted for multiple comparisons).
a_ancova() returns the corresponding list with formatted rtables::CellValue().
summarize_ancova(): Layout-creating function which can take statistics function arguments
and additional format arguments. This function is a wrapper for rtables::analyze().
s_ancova(): Statistics function that produces a named list of results
of the investigated linear model.
a_ancova(): Formatted analysis function which is used as afun in summarize_ancova().
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.