Learn R Programming

s20x (version 3.1-40)

summary2way: Two-way Analysis of Variance Summary

Description

Displays summary information for a two-way anova analysis. The lm object must come from a numerical response variable and factors. The output depends on the value of page:

Usage

summary2way(
  fit,
  page = c("table", "means", "effects", "interaction", "nointeraction"),
  digit = 5,
  conf.level = 0.95,
  print.out = TRUE,
  new = TRUE,
  all = FALSE,
  FUN = "identity",
  ...
)

Value

A list with the following components:

Df

degrees of freedom for regression, residual and total.

Sum of Sq

sum squares for regression, residual and total.

Mean Sq

mean squares for regression and residual.

F value

F-statistic value.

Pr(F)

The P-value assoicated with each F-test.

Grand Mean

The overall mean of the response variable.

Row Effects

The main effects for the first (row) factor.

Col Effects

The main effects for the second (column) factor.

Interaction Effects

The interaction effects if an interaction model has been fitted, otherwise NULL.

results

If new = TRUE, then this is a list with five components: table - the ANOVA table, means the table of means from model.tables, effects - the table of effects from model.tables, and comparisons - the differences in the means with standard errors, confidence bounds, and P-values from TukeyHSD

.

Arguments

fit

an lm object, i.e. the output from 'lm()'.

page

options for output: 'table', 'means', 'effects', 'interaction', 'nointeraction'

digit

the number of decimal places in the display.

conf.level

confidence level of the intervals.

print.out

if TRUE, print out the output on the screen.

new

if TRUE then this will run the new version of summary2way which should be more robust than the old version. It does not work in the same way however. In particular, when page = 'means' it does not return summary statistics for each grouping of the data (pooled/by row factor/by column factor/by interaction factor). Instead it simply returns the means for each grouping.

all

Only applicable to page = "interaction". If TRUE, pairwise comparisons for all combinations of factor levels are shown. Otherwise, comparisons are only shown between combinations that have the same level for one of the factors.

FUN

optional function to be applied to estimates and confidence intervals. Typically for backtransformation operations.

...

other arguments like inttype, pooled etc.

Details

page = 'table' anova table page = 'means' cell means matrix, numeric summary page = 'effects' table of effects page = 'interaction' tables of contrasts page = 'nointeraction' tables of contrasts

See Also

summary1way, model.tables, TukeyHSD

Examples

Run this code

##Arousal data:
data(arousal.df)
arousal.fit = lm(arousal ~ gender * picture, data = arousal.df)
summary2way(arousal.fit)

## Butterfat data:
data("butterfat.df")
fit <- lm(log(Butterfat)~Breed+Age, data=butterfat.df)
summary2way(fit, page="nointeraction", FUN = exp)

Run the code above in your browser using DataLab