model.tables
Compute Tables of Estimates for Model Object

Description

Computes tables of estimates and relevant standard errors for given model object.

Usage

model.tables(x, ...)
## S3 method for class 'aov':
model.tables(x, type = "effects", se = FALSE, cterms, ...) 
## S3 method for class 'aovlist':
model.tables(x, type = "effects", se = FALSE,  ...) 

# The methods for print function. ## S3 method for class 'tables_aov': print(x, digits = 4, ...) ## S3 method for class 'mtable': print(x, ..., digits = getOption("digits"), quote = FALSE, right = FALSE)

Arguments

x an object or class of object that depends on the method that you invoke. Specify the listed object for the following methods:
model.tables an aov object, or any object that inherits from class "aov" or "aovlist".

print.tables_aov

an object of class tables_aov, which is normally the returned value from function model.tables.

print.mtable

an object of class mtable, which is an element of the tables component of tables_aov object if you specified fitted means (means) as the table type.
type a character string that specifies the type of tables desired. Choices are:
"effects" tables of marginal effects for each term in the model.
"feffects" effects for factorial (2^k) models.
"means" tables of fitted means.
"residuals" tables of residuals.
You only need to specify enough of the character string to ensure that the value is unique.
se a logical value that specifies if standard errors should be computed for the tables. If se = FALSE (the default), standard errors are not computed. If se = TRUE, the se component that contains standard error information for each table is computed. The value that you specify in the type argument determines the form of the standard errors.
type = "effects" standard errors for individual effects.
type = "means" standard errors for the difference of two means.
type = "residuals" standard errors for residuals.
If you specify either type = "effects" or type = "means", you must balance the design for standard errors to be computed. You can use the se.contrast function to compute standard errors for unbalanced designs for contrasts of interest.
cterms a character vector that specifies the names of the terms for which tables should be computed. By default, tables for all terms in the model are computed.
... other optional arguments to pass to or from the function.
digits a numeric value that specifies the maximum number of (significant) digits to use. For more details, see print.default.
quote a logical value that specifies if character strings should be enclosed in quotation marks. If TRUE, quotation marks enclose character strings. This argument is designed to pass this setting to print.default.
right a logical value that specifies the alignment of character strings. If FALSE (the default), the output is left aligned. This argument is designed to pass this setting to print.default.

Details

This function is an S Version 3 generic (see Methods). A generic function adapts its action to match the class of an object by calling a method function specified for that class. You can create a method function to handle specific S Version 3 classes of data. Method functions for the classes aov and aovlist are included but they are hidden methods and cannot be invoked by calling model.tables.aov or model.tables.aovlist directly.
Currently, this function is implemented only for ANOVA objects to enable easy extraction of information about means, effects, residuals, and their standard errors. The function returns tables of means, effects, factorial effects, or residuals for an ANOVA model. The function also returns information on replication. For balanced designs, you can choose to have standard errors computed.
The hierarchy of the model defines effects. The effects are average responses due to the given treatment combinations, after having adjusted for all higher order model terms. For example, the interaction effects are changes in response after adjusting for the grand mean and both main effects. In the balanced case, the effects sum to zero.
Factorial effects are specific to 2^k models, where effects are conventionally defined as the difference between the upper and lower levels of a factor. We follow the convention used in Box, Hunter and Hunter (1978) for scaling of higher order interactions: all the factorial effects are on the same scale, and represent the average difference due to the interaction between two different levels.
Standard errors for differences of means (or SEDs) can be complex for multistratum anova (objects of class "aovlist"), even in the balanced case. This is because the standard error depends on the shared main effects of the means. For instance, different standard errors can apply for comparisons of means within the same stratum, as opposed to between different strata. Where different SEDs apply, the function returns a vector of SEDs with labels.
Treatment effects are sometimes computed in more than one stratum, with different efficiencies. For more information, see eff.aovlist. In this case, results are returned only for the most efficient strata, usually the lowest. The function does not attempt to recombine information about effects estimated in different strata. Effects, means, and standard errors are based on results that have been rescaled by their relative efficiency.
To construct the tables, model.tables invokes proj(aov.object), which is taken together with the auxiliary information returned with the projection. Therefore, when you fit the aov model, we recommend that you specify qr = TRUE.
print.tables_aov is a non-visible method for the generic function print for an object that inherits from class "tables_aov". This object is normally a returned value of function model.tables. For the general behavior of this function and for the interpretation of x, see print or print.default.
print.mtable is a non-visible method of generic function print for an object that inherits from class "mtable". This object is an element of the tables component from a tables_aov object when the table type is fitted means (type = means). Generally, this function is called internally by print.tables_aov to return the tables component of a tables_aov object when tables type is fitted means (type = means). For the general behavior of this function and for the interpretation of x, see print or print.default.
Value
model.tables returns an object of class "tables_aov", "list.of" with the following components:

tables a list of tables, one for each model term.
n a list that corresponds to the tables component, giving the replication factor for each table element. That is, the number of observations contributing to each element of the table. If type = "residuals", then n is the degrees of freedom.
se a list that corresponds to the tables component, giving standard error information for the tables. Only returned when se = TRUE.
print.tables_aov and print.mtable return the input argument x invisibly.
Differences between TIBCO Enterprise Runtime for R and Open-source R
The argument "type" for "feffects" and "residuals" are not implemented in open-source R.
References
Box, G. E. P., Hunter, W. G. and Hunter, J. S. 1978. Statistics for Experimenters. New York, NY: John Wiley & Sons.
Cochran, W. G., and Cox, G. M. 1957. Experimental Designs. New York, NY: John Wiley & Sons.
Searle, S. R. 1987. Linear Models for Unbalanced Data. New York, NY: John Wiley & Sons.
See Also
aov, eff.aovlist, proj, se.contrast.
Examples
# "gun" dataset is from the package Sdatasets. 
data("gun", package = "Sdatasets")
gun.aov <- aov(Rounds ~ Method + Physique/Team, gun) 
model.tables(gun.aov, type="effects") 
# Returns a list with two elements: tables of effects and tables of 
# replications 
print(model.tables(gun.aov, type="effects") ) # same as above

gun.aov <- aov(Rounds ~ Method + Team %in% Physique, data = gun) model.tables(gun.aov, type = "means", se = TRUE) # tables of means, replications, and standard errors # of differences for gun.aov model.tables(gun.aov, type = "means", cterms = "Method")

# "guayule" dataset is from the package Sdatasets. data("guayule", package = "Sdatasets") guayule.aov <- aov(plants ~ variety * treatment + Error(reps + flats), data = guayule) model.tables(guayule.aov, type = "eff", se = TRUE) # tables of effects, replications, and standard errors # for guayule.aov print(model.tables(guayule.aov, type = "eff", se = TRUE) ) # same as above.

Package stats version 6.0.0-69
Package Index