One of two functions for simple ANOVA tables and linear models without random effects, which use lm to fit a linear models.

  1. link{simple_anova}

  2. link{simple_model}

simple_model(data, Y_value, Fixed_Factor, ...)

Arguments

data

a data table object, e.g. data.frame or tibble.

Y_value

name of column containing quantitative (dependent) variable, provided within "quotes". The following transformations are permitted: "log(Y_value)", "log(Y_value + c)" where c a positive number, "logit(Y_value)" or "logit(Y_value/100)" which may be useful when Y_value are percentages (note quotes outside the log or logit calls); "sqrt(Y_value)" or "(Y_value)^2" should also work. During posthoc-comparisons, log and logit transformations will be back-transformed to the original scale. Other transformations, e.g., "sqrt(Y_value)" will not be back-transformed. Check out the regrid and ref_grid for details if you need back-transformation to the response scale.

Fixed_Factor

name(s) of categorical fixed factors (independent variables) provided within quotes (e.g., "A") or as a vector if more than one (e.g., c("A", "B"). If a numeric variable(s) is used, transformations similar to Y_value are permitted.

...

any additional arguments to pass on to lm if required.

Value

This function returns an object of class "lm".

Details

Update in v0.2.1: This function uses lm to fit a linear model to data, passes it on to Anova, and outputs the ANOVA table with type II sum of squares with F statistics and P values.

(Previous versions produced type I sum of squares using anova call.) It requires a data table, one quantitative dependent variable and one or more independent variables.

The model output can be used to extract coefficients and other information, including post-hoc comparisons. If your experiment design has random factors, use the related function mixed_model.

This function is related to link{simple_anova}. Output of this function can be used with posthoc_Pairwise, posthoc_Levelwise and posthoc_vsRef, or with emmeans.

Examples

#fixed factors provided as a vector
Doubmodel <- simple_model(data = data_doubling_time,
Y_value =  "Doubling_time", 
Fixed_Factor = "Student")
#get summary
summary(Doubmodel)
#> 
#> Call:
#> lm(formula = Doubling_time ~ Student, data = data_doubling_time)
#> 
#> Residuals:
#>     Min      1Q  Median      3Q     Max 
#> -3.8699 -0.8091 -0.0815  0.8474  2.9019 
#> 
#> Coefficients:
#>             Estimate Std. Error t value Pr(>|t|)    
#> (Intercept)  19.9619     1.1484  17.383 1.54e-13 ***
#> StudentB     -0.3713     1.6241  -0.229    0.821    
#> StudentC     -0.5929     1.6241  -0.365    0.719    
#> StudentD     -1.1728     1.6241  -0.722    0.479    
#> StudentE     -0.6286     1.6241  -0.387    0.703    
#> StudentF      0.7416     1.6241   0.457    0.653    
#> StudentG      0.4885     1.6241   0.301    0.767    
#> StudentH     -0.8083     1.6241  -0.498    0.624    
#> StudentI      0.6775     1.6241   0.417    0.681    
#> StudentJ      1.2115     1.6241   0.746    0.464    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual standard error: 1.989 on 20 degrees of freedom
#> Multiple R-squared:  0.1753,	Adjusted R-squared:  -0.1958 
#> F-statistic: 0.4725 on 9 and 20 DF,  p-value: 0.8761
#>