mean_differences_lm: A combination of mean comparison/separation and visualization...

Description Usage Arguments Value Examples

View source: R/model_mean_differences.R

Description

This package tidies up regression output to give mean summary table, using various other packages in cohert linear model and mean separation using DMRT/LSD or alike tests, from 'agricolae' package this function works best in conjuction with 'lm_list'

Usage

1
mean_differences_lm(model_list, treatment_factor_list)

Arguments

model_list

A list of linear model (lm) objects. This list must be named with respective response variable name in order that dataframe contains tidy names for columns

treatment_factor_list

A list of single treatment factor or multiple treatment factors or interaction between two treatment factors. In any way the terms fitted to the all response must all be same.

Value

A tbl

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
# model marginal mean
mt_trial <- mtcars 
  rownames_to_column("vehicle_name") 
  as_tibble() 
  mutate_at(c("vehicle_name", "vs", "am"), as.factor)

mt_lm1 <- lm(`mpg`~`am`*`vs` + `hp`, data = mt_trial)
mt_lm2 <- lm(`drat`~`am`*`vs` + `hp` + `disp`, data = mt_trial)
mt_lm3 <- lm(`qsec`~`am`*`vs` + `hp`, data = mt_trial)

mt_named_list <- list(mt_lm1, mt_lm2, mt_lm3) 
  set_names(c("response_1st", "response_2nd", "response_3rd"))

mt_treatment_factor_list <- list("am", "vs", c("am", "vs"))

# main effects and interaction effects means for two factors using lm tidier
mean_differences_lm(model_list = mt_named_list, treatment_factor_list = mt_treatment_factor_list)

## End(Not run)

DeependraD/expdean documentation built on Nov. 25, 2019, 12:33 a.m.