lma_check: Checks linear model assumptions of a multiple regression...

View source: R/aba.R

lma_checkR Documentation

Checks linear model assumptions of a multiple regression model

Description

The performed tests are:

  • partial p.values calculated by lm are all below a given value

  • tests implemented by gvlma

  • variance inflation factors calculated by vif are all below a given value

Usage

lma_check(formule, df, max.pvalue = 0.05, max.vif = 5)

Arguments

formule

formula. model to be evaluated

df

data.frame. data to evaluate the model

max.pvalue

numeric. maximum p-value of variables included in the model

max.vif

numeric. maximum variance inflation factor of variables included in the model

Value

a one line data.frame with 5 columns.

  • a string: evaluated formula

  • a numeric: the adjusted R squared of the model

  • a boolean: do all variables in the model have a partial p-value < max.pvalue

  • a boolean: are all tests implemented by gvlma false

  • a boolean: is the variance inflation factor computed with vif of all variables < max.vif

Examples

# load Quatre Montagnes dataset
data(quatre_montagnes)
# fit lm model
model <- lm(G_m2_ha ~ zmax + zq95, data = quatre_montagnes)
lma_check(eval(model$call[[2]]), quatre_montagnes)
# trying with Box-Cox transformation of dependent variable
# and other independent variables
model <- lm(boxcox_tr(G_m2_ha, -0.14) ~ Tree_meanH + Tree_density + zpcum7, data = quatre_montagnes)
lma_check(eval(model$call[[2]]), quatre_montagnes)

lidaRtRee documentation built on April 3, 2025, 10:29 p.m.