check.hom | R Documentation |
This function takes a linear model object as an argument and checks whether the residuals are homoscedastic, in relation to a stratification variable, that is given as an argument.
check.hom(obj, var)
obj |
a linear model object fitted with lm() |
var |
a vector containing a stratification variable |
The function fits a gls with same structure as the input model, together with a heteroscedastic gls, where residuals are allowed to assume a different variance for each level of the stratification variable. The two models are compared by a LRT
LRT |
the value of LRT |
LRT |
the P-value of LRT |
aovtable |
a summary table for the LRT |
modHet |
the gls object containing the heteroscedastic fit |
Andrea Onofri
fileName <- "https://www.casaonofri.it/_datasets/FGP_rape.csv"
library(aomisc)
dataset <- read.csv(fileName)
dataset[,1:5] <- lapply(dataset[,1:5], factor)
mod <- lm(FGP ~ Genotype * Run, data = dataset)
check <- check.hom(mod, Run)
check$aovtable
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.