Linear Model with AIC or BIC selection, and with the contrasts sum (the sum of the coefficients is 0) if any categorical variables
Linear Model with AIC or BIC selection, and with the contrasts sum (the sum of the coefficients is 0) if any categorical variables
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
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".
Returns
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)