
Extract Longitudinal Mixed-Effect Results
Source:R/analysis_result_extractors.R, R/analysis_result_visualization_advanced.R
mixed_effect_result_api.RdReturn the tidy result table from a longitudinal_mixed_effect_result
object.
Wrap external mixed-effect model output in a standardized result class and visualize the resulting effect estimates.
Usage
extract_longitudinal_mixed_effect_result(object)
as_tibble_longitudinal_mixed_effect(object)
create_longitudinal_mixed_effect_result(
result,
method = "external",
time_variable = "",
group_variable = ""
)
plot_longitudinal_mixed_effect(object, term = NULL, top_n = 20)
plot_longitudinal_effect_heatmap(object, top_n = 30)Arguments
- object
A
longitudinal_mixed_effect_resultobject.- result
A data.frame containing at least
feature,term, andestimate.- method
Modeling method label.
- time_variable
Time variable used in the model.
- group_variable
Optional grouping variable.
- term
Optional model term retained for plotting.
- top_n
Maximum number of features displayed.
Value
A data.frame.
A tibble.
A longitudinal_mixed_effect_result object.
A ggplot object.
A ggplot object.
Functions
plot_longitudinal_mixed_effect(): Draw a forest plot of feature-level mixed-effect estimates.plot_longitudinal_effect_heatmap(): Show feature-by-term effect estimates as a heatmap.
Examples
x <- create_longitudinal_mixed_effect_result(
result = data.frame(
feature = paste0("Taxon", 1:4),
term = "time",
estimate = c(0.4, -0.2, 0.1, 0.3)
),
time_variable = "time"
)
head(extract_longitudinal_mixed_effect_result(x))
#> feature term estimate p_value q_value
#> 1 Taxon1 time 0.4 NA NA
#> 2 Taxon2 time -0.2 NA NA
#> 3 Taxon3 time 0.1 NA NA
#> 4 Taxon4 time 0.3 NA NA
x <- create_longitudinal_mixed_effect_result(
result = data.frame(
feature = paste0("Taxon", 1:4),
term = "time",
estimate = c(0.4, -0.2, 0.1, 0.3)
),
time_variable = "time"
)
class(as_tibble_longitudinal_mixed_effect(x))
#> [1] "tbl_df" "tbl" "data.frame"
result <- data.frame(
feature = paste0("Taxon", 1:4),
term = "time",
estimate = c(0.4, -0.2, 0.1, 0.3),
lower_ci = c(0.2, -0.4, -0.1, 0.1),
upper_ci = c(0.6, 0.0, 0.3, 0.5)
)
create_longitudinal_mixed_effect_result(
result,
method = "external",
time_variable = "time",
group_variable = "group"
)
#> longitudinal_mixed_effect_result
#> Method: external
#> Time variable: time
#> Group variable: group
#> Rows: 4