LinearModel {FactoMineR} R Documentation

## Linear Model with AIC or BIC selection, and with the contrasts sum (the sum of the coefficients is 0) if any categorical variables

### Description

Linear Model with AIC or BIC selection, and with the contrasts sum (the sum of the coefficients is 0) if any categorical variables
Test for all the coefficients
Handle missing values

### Usage

LinearModel(formula, data, na.action = na.omit, type = c("III","II", 3, 2),
selection=c("none","aic","bic"), ...)


### Arguments

 formula the formula for the model 'y~x1+x2+x1:x2' data a data-frame na.action (where relevant) information returned by model.frame on the special handling of NAs. type type of test, "III", "II", 3 or 2. Roman numerals are equivalent to the corresponding Arabic numerals. selection a string that defines the model selection according to "BIC" for Bayesian Information Criterion or "AIC" for Akaike Information Criterion; "none", by defaut, means that there is no selection. ... other arguments, cf the function lm

### Details

The Anova function of the package car is used to calculate the F-tests.

The t-tests are obtained using the contrasts "contr.sum" which means that 'sum to zero contrasts'.

A stepwise procedure (using both backword and forward selections) is performed to select a model if selection="AIC" or selection="BIC".

### Value

The outouts

 Ftest a table with the F-tests Ttest a table with the t-tests lmResult the summary of the function lm call the matched call lmResultComp the summary of the lm function for the complete model (given only if a selection is performed) callComp the matched call for the complete model (given only if a selection is performed)

### Author(s)

Francois Husson francois.husson@institut-agro.fr

aov, lm, print.LinearModel

### Examples

## Example two-way anova
data(senso)
res <- LinearModel(Score~ Product + Day , data=senso, selection="none")
res
## Perform means comparison
meansComp(res,~Product)

## Example two-way anova with interaction
data(senso)
res2 <- LinearModel(Score~ Product + Day + Product : Day, data=senso, selection="none")
res2
meansComp(res,~Product:Day)

## Example two-way anova with selection
data(senso)
res2 <- LinearModel(Score~ Product + Day + Product : Day, data=senso, selection="BIC")
res2

## Example ancova
data(footsize)
res3 <- LinearModel(footsize ~ size + sex + size : sex, data=footsize)
res3


[Package FactoMineR version 2.11 Index]