<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Hair and Eye Color of Statistics Students</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="R.css">
</head><body>

<table width="100%" summary="page for HairEyeColor"><tr><td>HairEyeColor</td><td align="right">R Documentation</td></tr></table>

<h2>Hair and Eye Color of Statistics Students</h2>

<h3>Description</h3>


<p>Distribution of hair and eye color and sex in 592 statistics students.
</p>


<h3>Usage</h3>

<pre>HairEyeColor</pre>


<h3>Format</h3>


<p>A 3-dimensional array resulting from cross-tabulating 592 observations
on 3 variables.  The variables and their levels are as follows:
</p>

<table summary="Rd table">
<tr>
 <td align="right">
    No </td><td align="left"> Name </td><td align="left"> Levels </td>
</tr>
<tr>
 <td align="right">
    1 </td><td align="left"> Hair </td><td align="left"> Black, Brown, Red, Blond </td>
</tr>
<tr>
 <td align="right">
    2 </td><td align="left"> Eye </td><td align="left"> Brown, Blue, Hazel, Green </td>
</tr>
<tr>
 <td align="right">
    3 </td><td align="left"> Sex </td><td align="left"> Male, Female
  </td>
</tr>

</table>



<h3>Details</h3>


<p>The Hair <i>x</i> Eye table comes rom a survey of students at
the University of Delaware reported by Snee (1974).  The split by
<code>Sex</code> was added by Friendly (1992a) for didactic purposes.
</p>
<p>This data set is useful for illustrating various techniques for the
analysis of contingency tables, such as the standard chi-squared test
or, more generally, log-linear modelling, and graphical methods such
as mosaic plots, sieve diagrams or association plots.
</p>


<h3>Source</h3>


<p><a href="http://euclid.psych.yorku.ca/ftp/sas/vcd/catdata/haireye.sas">http://euclid.psych.yorku.ca/ftp/sas/vcd/catdata/haireye.sas</a>
</p>
<p>Snee (1974) gives the two-way table aggregated over <code>Sex</code>.  The
Sex split of the &lsquo;Brown hair, Brown eye&rsquo; cell was changed in
<font face="Courier New,Courier" color="#666666"><b>R</b></font> 2.6.0 to agree with that used by Friendly (2000).
</p>


<h3>References</h3>


<p>Snee, R. D. (1974)
Graphical display of two-way contingency tables.
<EM>The American Statistician</EM>, <B>28</B>, 9&ndash;12.
</p>
<p>Friendly, M. (1992a)
Graphical methods for categorical data.
<EM>SAS User Group International Conference Proceedings</EM>, <B>17</B>,
190&ndash;200.
<a href="http://www.math.yorku.ca/SCS/sugi/sugi17-paper.html">http://www.math.yorku.ca/SCS/sugi/sugi17-paper.html</a>
</p>
<p>Friendly, M. (1992b)
Mosaic displays for loglinear models.
<EM>Proceedings of the Statistical Graphics Section</EM>,
American Statistical Association, pp. 61&ndash;68.
<a href="http://www.math.yorku.ca/SCS/Papers/asa92.html">http://www.math.yorku.ca/SCS/Papers/asa92.html</a>
</p>
<p>Friendly, M. (2000)
<EM>Visualizing Categorical Data.</EM>
SAS Institute, ISBN 1-58025-660-0.
</p>


<h3>See Also</h3>


<p><code>chisq.test</code>,
<code>loglin</code>,
<code>mosaicplot</code>
</p>


<h3>Examples</h3>

<pre>
require(graphics)
## Full mosaic
mosaicplot(HairEyeColor)
## Aggregate over sex (as in Snee's original data)
x &lt;- apply(HairEyeColor, c(1, 2), sum)
x
mosaicplot(x, main = "Relation between hair and eye color")
</pre>


</body></html>
