simple_model: Model from a linear model fit to data.

View source: R/simple_model.R

simple_modelR Documentation

Model from a linear model fit to data.

Description

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}

Usage

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".

Fixed_Factor

name(s) of categorical fixed factors (independent variables) provided as a vector if more than one or within "quotes".

...

any additional arguments to pass on to lm if required.

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.

Value

This function returns an object of class "lm".

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)

grafify documentation built on May 29, 2024, 3:49 a.m.