forked from vincentarelbundock/Rdatasets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TV.html
113 lines (84 loc) · 3.71 KB
/
TV.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html><html><head><title>R: TV Viewing Data</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css">
<script type="text/javascript">
const macros = { "\\R": "\\textsf{R}", "\\code": "\\texttt"};
function processMathHTML() {
var l = document.getElementsByClassName('reqn');
for (let e of l) { katex.render(e.textContent, e, { throwOnError: false, macros }); }
return;
}</script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js"
onload="processMathHTML();"></script>
<link rel="stylesheet" type="text/css" href="R.css" />
</head><body><div class="container"><main>
<table style="width: 100%;"><tr><td>TV</td><td style="text-align: right;">R Documentation</td></tr></table>
<h2>TV Viewing Data</h2>
<h3>Description</h3>
<p>This data set <code>TV</code> comprises a 5 x 11 x 3 contingency table based on
audience viewing data from Neilsen Media Research for the week starting
November 6, 1995.
</p>
<h3>Usage</h3>
<pre><code class='language-R'>data(TV)</code></pre>
<h3>Format</h3>
<p>A 5 x 11 x 3 array of cell frequencies with the following structure:
</p>
<pre>
int [1:5, 1:11, 1:3] 146 244 233 174 294 151 181 161 183 281 ...
- attr(*, "dimnames")=List of 3
..$ Day : chr [1:5] "Monday" "Tuesday" "Wednesday" "Thursday" ...
..$ Time : chr [1:11] "8:00" "8:15" "8:30" "8:45" ...
..$ Network: chr [1:3] "ABC" "CBS" "NBC"
</pre>
<h3>Details</h3>
<p>The original data, <code>tv.dat</code>, contains two additional networks: "Fox" and "Other", with small
frequencies. These levels were removed in the current version.
There is also a fourth factor, transition State
transition (turn the television Off, Switch channels, or Persist in viewing the current channel).
The <code>TV</code> data here includes only the Persist observations.
</p>
<h3>Source</h3>
<p>The original data, <code>tv.dat</code>, came from the initial implementation of
mosaic displays in R by Jay Emerson (1998). Similar data had been used by
Hartigan and Kleiner (1984) as an illustration.
</p>
<h3>References</h3>
<p>Friendly, M. and Meyer, D. (2016).
<em>Discrete Data Analysis with R: Visualization and Modeling Techniques for Categorical and Count Data</em>.
Boca Raton, FL: Chapman & Hall/CRC. <a href="http://ddar.datavis.ca">http://ddar.datavis.ca</a>.
</p>
<p>Emerson, John W. Mosaic Displays in S-PLUS: A General Implementation and a Case Study.
<em>Statistical Graphics and Computing Newsletter</em>, 1998, 9(1), 17–23,
<a href="http://www.stat.yale.edu/~jay/R/mosaic/v91.pdf">http://www.stat.yale.edu/~jay/R/mosaic/v91.pdf</a>
</p>
<p>Hartigan, J. A. & Kleiner, B. A Mosaic of Television Ratings. <em>The American Statistician</em>, 1984, 38, 32-35.
</p>
<h3>Examples</h3>
<pre><code class='language-R'>data(TV)
structable(TV)
doubledecker(TV)
# reduce number of levels of Time
TV.df <- as.data.frame.table(TV)
levels(TV.df$Time) <- rep(c("8:00-8:59", "9:00-9:59", "10:00-10:44"),
c(4, 4, 3))
TV2 <- xtabs(Freq ~ Day + Time + Network, TV.df)
# re-label for mosaic display
levels(TV.df$Time) <- c("8", "9", "10")
# fit mode of joint independence, showing association of Network with Day*Time
mosaic(~ Day + Network + Time,
data = TV.df,
expected = ~ Day:Time + Network,
legend = FALSE)
# with doubledecker arrangement
mosaic(~ Day + Network + Time,
data = TV.df,
expected = ~ Day:Time + Network,
split = c(TRUE, TRUE, FALSE),
spacing = spacing_highlighting,
legend = FALSE)
</code></pre>
</main>
</div>
</body></html>