save_lm_diagnostic_plots: Plot model diagnostics

Description Usage Arguments Examples

View source: R/model_diagnostics.R

Description

Plot model diagnostics for lm or lmer models fit separately for each feature. One page of plots is saved per feature. Uses autoplot function from ggfortify

Usage

1
2
save_lm_diagnostic_plots(object, formula_char, model_type = c("lm",
  "lmer"), file, all_features = FALSE, width = 12, height = 18, ...)

Arguments

object

a MetaboSet object

formula_char

character, the formula to be used in the linear model (see Details)

model_type

the type of model, either "lm" or "lmer"

file

the file where the plots will be saved

all_features

should all features be included?

width, height

the dimension of the plot

...

other parameters passed to lm/lmer and/or autoplot function from the ggfortify package

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
save_lm_diagnostic_plots(example_set, formula_char = "Feature ~ Group", model_type = "lm", file = "test.pdf")

# Add colouring by time point (don't mind the warnings)
save_lm_diagnostic_plots(example_set, formula_char = "Feature ~ Group",
                         model_type = "lm", file = "test.pdf", colour = "Group")

# Linear mixed model
save_lm_diagnostic_plots(example_set, formula_char = "Feature ~ Group + (1|Subject_ID)",
                         model_type = "lmer", file = "test.pdf")

## End(Not run)

antonvsdata/amp documentation built on Jan. 8, 2020, 3:15 a.m.