# Analysis of Variance - Table of Means

Create a table showing the mean of an **Outcome** variable, by two other variables, where one is shown in the **Rows** and the other in the **Columns**

Create a table showing the mean of an **Outcome** variable, by two other variables, where one is shown in the **Rows** and the other in the **Columns**. Each row shows a separate one-way analysis of variance, with the variance parameter assumed constant across all of the rows (unless using robust standard errors). If the *Outcome* is not numeric and if the *Rows* and *Columns* are not categorical, they are coerced to such types.

## How to Create a Table of Means

- Add the object by selecting from the men
**Automate > Browse Online Library > Analysis of Variance > Table of Means** - In
**Inputs > Outcome**specify the outcome variable. - Specify the predictor variables in
**Inputs > Rows**annd**Inputs > Columns.**

## Example

## Options

The options in the Object Inspector are organized into two tabs: **Inputs** and **Properties**.

### Inputs

**Outcome** The variable to be predicted.

**Rows** A variable containing 2 or more groups. If not categorical, it is converted into categories in the analysis.

**Columns** A variable containing 2 or more groups. If not categorical, it is converted into categories in the analysis.

**Correction** The multiple comparisons correction applied when computing the *p*-values of the *post-hoc* comparisons.

**Robust standard errors** Computes standard errors that are robust to violations of the assumption of constant variance. See Robust Standard Errors.

**Variable names** Displays Variable Names in the output.

**Filter** The data is automatically filtered using any filters prior to estimating the model.

**Weight** Where a weight has been set for the R Output, the calibrated weight is used. See Weights in R.

### Properties

This tab contains options for formatting the size of the object, as well as the underlying R code used to create the visualization, and the JavaScript code use to customize the *Object Inspector* itself (see Object Inspector for more details about these options). Additional options are available by editing the code.

## More Information

## Acknowledgements

The linear model is fitted using the `lm` and `manova` functions in R. See Analysis of Variance - One-Way ANOVA for acknowledgements relating to the ANOVAs in the outputs.

## Code

```
var heading_text = 'Table Of Means';
if (!!form.setObjectInspectorTitle)
form.setObjectInspectorTitle(heading_text, 'Tables Of Means')
else
form.setHeading(heading_text);
form.dropBox({label: "Outcome",
types:["Variable: Numeric, Date, Money, Categorical, OrderedCategorical"],
name: "formOutcomeVariable",
prompt: "Numeric outcome variable, for which means are computed",
multi:false})
form.dropBox({label: "Rows",
types:["Variable: Numeric, Date, Money, Categorical, OrderedCategorical"],
prompt: "Categorical grouping variable for rows",
name: "formRows"})
form.dropBox({label: "Columns",
types:["Variable: Numeric, Date, Money, Categorical, OrderedCategorical"],
prompt: "Categorical grouping variable for columns",
name: "formColumns"})
form.comboBox({label: "Correction",
alternatives: [ "None", "False Discovery Rate", "Table FDR", "Tukey Range", "Benjamini & Yekutieli", "Bonferroni", "Free Combinations", "Hochberg", "Holm", "Hommel", "Single-step", "Shaffer", "Westfall"],
prompt: "Multiple comparisons correction used when calculating p-values",
name: "formCorrection", default_value: "Table FDR"})
form.checkBox({label: "Robust standard errors", name: "formRobust", default_value: false,
prompt: "Compute standard errors that are robust to violations of the assumption of constant variance"})
form.checkBox({label: "Variable names", name: "formNames", default_value: false, prompt: "Whether to use variable names instead of labels"})
```

```
library(flipAnalysisOfVariance)
means <- TableOfMeans(QInputs(formOutcomeVariable),
QInputs(formRows),
QInputs(formColumns),
correction = formCorrection,
robust.se = formRobust,
subset = QFilter,
weights = QPopulationWeight,
show.labels = !formNames)
```