[IPSUR-commits] r179 - pkg/IPSUR/inst/doc www/book/download
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jul 27 05:47:41 CEST 2010
Author: gkerns
Date: 2010-07-27 05:47:40 +0200 (Tue, 27 Jul 2010)
New Revision: 179
Modified:
pkg/IPSUR/inst/doc/IPSUR.Rnw
www/book/download/IPSUR.bib
www/book/download/IPSUR.lyx
www/book/download/IPSUR.zip
Log:
regenerated IPSUR to match the version on CRAN
Modified: pkg/IPSUR/inst/doc/IPSUR.Rnw
===================================================================
--- pkg/IPSUR/inst/doc/IPSUR.Rnw 2010-07-25 15:17:56 UTC (rev 178)
+++ pkg/IPSUR/inst/doc/IPSUR.Rnw 2010-07-27 03:47:40 UTC (rev 179)
@@ -32,7 +32,7 @@
{hyperref}
\hypersetup{pdftitle={Introduction to Probability and Statistics Using R},
pdfauthor={G. Jay Kerns},
- linkcolor=blue, citecolor=black, urlcolor=blue}
+ linkcolor=black, citecolor=black, urlcolor=black}
\makeatletter
@@ -154,11 +154,11 @@
%% Sweave specific commands
% make the input blue, output red
-\DefineVerbatimEnvironment{Soutput}{Verbatim}{formatcom=\color{blue}}
-\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl, formatcom=\color{red}}
+%\DefineVerbatimEnvironment{Soutput}{Verbatim}{formatcom=\color{blue}}
+%\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl, formatcom=\color{red}}
% make the input/output black
-%\DefineVerbatimEnvironment{Soutput}{Verbatim}{formatcom=\color{black}}
-%\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl, formatcom=\color{black}}
+\DefineVerbatimEnvironment{Soutput}{Verbatim}{formatcom=\color{black}}
+\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl, formatcom=\color{black}}
% get rid of extra Sweave space
Modified: www/book/download/IPSUR.bib
===================================================================
--- www/book/download/IPSUR.bib 2010-07-25 15:17:56 UTC (rev 178)
+++ www/book/download/IPSUR.bib 2010-07-27 03:47:40 UTC (rev 179)
@@ -1,4 +1,4 @@
-% This file was created with JabRef 2.3.1.
+% This file was created with JabRef 2.5.
% Encoding: UTF-8
@MANUAL{foreign,
@@ -415,6 +415,17 @@
url = {http://astro.temple.edu/~rmh/HH/}
}
+ at BOOK{RthroughExcel,
+ title = {R Through Excel: A Spreadsheet Interface for Statistics, Data Analysis,
+ and Graphics},
+ publisher = {Springer},
+ year = {2009},
+ author = {Heiberger, Richard M. and Neuwirth, Erich},
+ owner = {jay},
+ timestamp = {2010.07.25},
+ url = {http://www.springer.com/statistics/computanional+statistics/book/978-1-4419-0051-7}
+}
+
@BOOK{Hogg2005,
title = {Introduction to Mathematical Statistics},
publisher = {Pearson Prentice Hall},
Modified: www/book/download/IPSUR.lyx
===================================================================
--- www/book/download/IPSUR.lyx 2010-07-25 15:17:56 UTC (rev 178)
+++ www/book/download/IPSUR.lyx 2010-07-27 03:47:40 UTC (rev 179)
@@ -66,12 +66,11 @@
% make the input blue, output red
%\DefineVerbatimEnvironment{Soutput}{Verbatim}{formatcom=\color{blue}}
%\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl, formatcom=\color{red}}
-% make the output black
+% make the input/output black
\DefineVerbatimEnvironment{Soutput}{Verbatim}{formatcom=\color{black}}
\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl, formatcom=\color{black}}
-
% get rid of extra Sweave space
\fvset{listparameters={\setlength{\topsep}{0pt}}}
\renewenvironment{Schunk}{\vspace{\topsep}}{\vspace{\topsep}}
@@ -85,6 +84,13 @@
numberstyle = {\ttfamily},
morestring=[b]"
}
+
+% Turn on questions and answers
+\newcommand{\question}[1]{#1}
+\newcommand{\answer}[1]{#1}
+% Turn off questions and answers
+%\newcommand{\question}[1]{}
+%\newcommand{\answer}[1]{}
\end_preamble
\options nogin
\use_default_options false
@@ -108,7 +114,7 @@
\graphics default
\paperfontsize 12
-\spacing other 1.2
+\spacing single
\use_hyperref true
\pdf_title "Introduction to Probability and Statistics Using R"
\pdf_author "G. Jay Kerns"
@@ -149,6 +155,10 @@
\selected 1
\color #faf0e6
\end_branch
+\branch main
+\selected 1
+\color #faf0e6
+\end_branch
\leftmargin 1in
\topmargin 1in
\rightmargin 1in
@@ -1148,7 +1158,7 @@
\begin_layout Standard
\noindent
-Timestamp:
+Date:
\begin_inset ERT
status open
@@ -1161,7 +1171,11 @@
\end_inset
-
+
+\end_layout
+
+\begin_layout Standard
+\noindent
\begin_inset VSpace vfill
\end_inset
@@ -1208,6 +1222,11 @@
\end_layout
\begin_layout Standard
+\noindent
+\begin_inset Branch main
+status open
+
+\begin_layout Standard
\begin_inset ERT
status open
@@ -2649,6 +2668,12 @@
\end_layout
\begin_layout Standard
+I would like to thank Richard Heiberger for his insightful comments and
+ improvements to several points and displays in the manuscript.
+
+\end_layout
+
+\begin_layout Standard
Finally, and most importantly, I would like to thank my wife for her patience
and understanding while I worked hours, days, months, and years on a
\emph on
@@ -2746,6 +2771,11 @@
\end_layout
+\end_inset
+
+
+\end_layout
+
\begin_layout Chapter
An Introduction to Probability and Statistics
\end_layout
@@ -2767,6 +2797,12 @@
\end_layout
\begin_layout Standard
+\noindent
+\begin_inset Branch main
+status open
+
+\begin_layout Standard
+\noindent
This chapter has proved to be the hardest to write, by far.
The trouble is that there is so much to say -- and so many people have
already said it so much better than I could.
@@ -2859,29 +2895,71 @@
.
I plan to add more bayesian material in later editions of this book.
-
\end_layout
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section*
+Chapter Exercises
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+addcontentsline{toc}{section}{Chapter Exercises}
+\end_layout
+
+\begin_layout Plain Layout
+
+
+\backslash
+setcounter{thm}{0}
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
\begin_layout Chapter
An Introduction to
\family sans
R
\begin_inset CommandInset label
LatexCommand label
-name "cha:An-Introduction-to-R"
+name "cha:introduction-to-R"
\end_inset
\end_layout
+\begin_layout Standard
+\begin_inset Branch main
+status open
+
\begin_layout Section
Downloading and Installing
\family sans
R
\begin_inset CommandInset label
LatexCommand label
-name "sec:Downloading-and-Installing-R"
+name "sec:download-install-R"
\end_inset
@@ -2928,7 +3006,7 @@
Windows:
\begin_inset Flex URL
-status collapsed
+status open
\begin_layout Plain Layout
@@ -2943,11 +3021,11 @@
\begin_layout Description
MacOS:
\begin_inset Flex URL
-status collapsed
+status open
\begin_layout Plain Layout
-http://cran.r-project/bin/macosx
+http://cran.r-project.org/bin/macosx/
\end_layout
\end_inset
@@ -2958,11 +3036,11 @@
\begin_layout Description
Linux:
\begin_inset Flex URL
-status collapsed
+status open
\begin_layout Plain Layout
-http://cran.r-project/bin/linux
+http://cran.r-project.org/bin/linux/
\end_layout
\end_inset
@@ -2971,7 +3049,7 @@
\end_layout
\begin_layout Standard
-On MS-Windows, click the
+On Microsoft Windows, click the
\color none
\begin_inset listings
@@ -2981,21 +3059,22 @@
\begin_layout Plain Layout
-.exe
+R-x.y.z.exe
\end_layout
\end_inset
\color inherit
- program file to start installation.
+ installer to start installation.
When it asks for "Customized startup options", specify
\family sans
Yes
\family default
.
- In the next window, be sure to select the SDI (single-window) option; this
- is useful later when we discuss three dimensional plots with the
+ In the next window, be sure to select the SDI (single document interface)
+ option; this is useful later when we discuss three dimensional plots with
+ the
\color none
\begin_inset listings
@@ -3022,11 +3101,218 @@
.
\end_layout
+\begin_layout Paragraph*
+Installing
+\family sans
+R
+\family default
+ on a USB drive (Windows)
+\end_layout
+
+\begin_layout Standard
+With this option you can use
+\family sans
+R
+\family default
+ portably and without administrative privileges.
+ There is an entry in the
+\family sans
+R
+\family default
+ for Windows FAQ about this.
+ Here is the procedure I use:
+\end_layout
+
+\begin_layout Enumerate
+Download the Windows installer above and start installation as usual.
+ When it asks
+\emph on
+where
+\emph default
+ to install, navigate to the top-level directory of the USB drive instead
+ of the default
+\color none
+
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+C
+\end_layout
+
+\end_inset
+
+
+\color inherit
+ drive.
+\end_layout
+
+\begin_layout Enumerate
+When it asks whether to modify the Windows registry, uncheck the box; we
+ do NOT want to tamper with the registry.
+
+\end_layout
+
+\begin_layout Enumerate
+After installation, change the name of the folder from
+\color none
+
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+R-x.y.z
+\end_layout
+
+\end_inset
+
+
+\color inherit
+ to just plain
+\color none
+
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+R
+\end_layout
+
+\end_inset
+
+
+\color inherit
+.
+ (Even quicker: do this in step 1.)
+\end_layout
+
+\begin_layout Enumerate
+Download the following shortcut to the top-level directory of the USB drive,
+ right beside the
+\color none
+
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+R
+\end_layout
+
+\end_inset
+
+
+\color inherit
+ folder, not inside the folder.
+\end_layout
+
+\begin_deeper
+\begin_layout Standard
+\align center
+\begin_inset Flex URL
+status open
+
+\begin_layout Plain Layout
+
+http://ipsur.r-forge.r-project.org/book/download/R.exe
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Use the downloaded shortcut to run
+\family sans
+R
+\family default
+.
+\end_layout
+
+\end_deeper
+\begin_layout Standard
+Steps 3 and 4 are not required but save you the trouble of navigating to
+ the
+\color none
+
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+R-x.y.z/bin
+\end_layout
+
+\end_inset
+
+
+\color inherit
+ directory to double-click
+\color none
+
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+Rgui.exe
+\end_layout
+
+\end_inset
+
+
+\color inherit
+ every time you want to run the program.
+ It is useless to create your own shortcut to
+\color none
+
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+Rgui.exe
+\end_layout
+
+\end_inset
+
+
+\color inherit
+.
+ Windows does not allow shortcuts to have relative paths; they always have
+ a drive letter associated with them.
+ So if you make your own shortcut and plug your USB drive into some
+\emph on
+other
+\emph default
+ machine that happens to assign your drive a different letter, then your
+ shortcut will no longer be pointing to the right place.
+
+\end_layout
+
\begin_layout Subsection
Installing and Loading Add-on Packages
\begin_inset CommandInset label
LatexCommand label
-name "sub:Installing-and-Loading-packages"
+name "sub:installing-loading-packages"
\end_inset
@@ -3745,11 +4031,27 @@
\family default
do all of the tricks that the other script editors offer, and much, much,
more.
+ Please see the following for installation details, documentation, reference
+ cards, and a whole lot more:
\end_layout
-\begin_deeper
\begin_layout Standard
+\align center
+\begin_inset Flex URL
+status open
+\begin_layout Plain Layout
+
+http://ess.r-project.org
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+
\emph on
Fair warning
\emph default
@@ -3764,7 +4066,6 @@
and I will never go back.
\end_layout
-\end_deeper
\begin_layout Description
JGR
\begin_inset space ~
@@ -4429,7 +4730,7 @@
\begin_inset Formula $\me$
\end_inset
-, Euler's constant.
+, Euler's number.
\end_layout
\begin_layout Subsection
@@ -7997,7 +8298,12 @@
\end_layout
-\begin_layout Section
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section*
Chapter Exercises
\end_layout
@@ -8009,6 +8315,13 @@
\backslash
+addcontentsline{toc}{section}{Chapter Exercises}
+\end_layout
+
+\begin_layout Plain Layout
+
+
+\backslash
setcounter{thm}{0}
\end_layout
@@ -8029,6 +8342,11 @@
\end_layout
\begin_layout Standard
+\begin_inset Branch main
+status open
+
+\begin_layout Standard
+\noindent
In this chapter we introduce the different types of data that a statistician
is likely to encounter, and in each subsection we give some examples of
how to display the data of that particular type.
@@ -8562,7 +8880,7 @@
(see Section
\begin_inset CommandInset ref
LatexCommand ref
-reference "sub:Other-data-types"
+reference "sub:other-data-types"
\end_inset
@@ -10493,9 +10811,9 @@
\end_layout
\begin_layout Standard
-A bar graph is the analogue of a histogram, but for categorical data.
- A bar is displayed for each level of a factor, with the height of the bars
- proportional to the frequencies of observations falling in the respective
+A bar graph is the analogue of a histogram for categorical data.
+ A bar is displayed for each level of a factor, with the heights of the
+ bars proportional to the frequencies of observations falling in the respective
categories.
A disadvantage of bar graphs is that the levels are ordered alphabetically
(by default), which may sometimes obscure patterns in the display.
@@ -10513,21 +10831,7 @@
\series default
\color none
- The U.S.
-\begin_inset space ~
-\end_inset
-
-Department of Commerce U.S.
-\begin_inset space ~
-\end_inset
-
-Census Bureau, releases all sorts of information in the
-\emph on
-\color inherit
-Statistical Abstract of the United States
-\emph default
-\color none
-, and the
+ The
\begin_inset listings
lstparams "showstringspaces=false"
inline true
@@ -11059,10 +11363,14 @@
\begin_inset Newline newline
\end_inset
-dotchart(table(state.region))
+x <- table(state.region)
\begin_inset Newline newline
\end_inset
+dotchart(as.vector(x), labels = names(x))
+\begin_inset Newline newline
+\end_inset
+
@
\end_layout
@@ -11078,10 +11386,14 @@
\begin_inset Newline newline
\end_inset
-dotchart(table(state.region))
+x <- table(state.region)
\begin_inset Newline newline
\end_inset
+dotchart(as.vector(x), labels = names(x))
+\begin_inset Newline newline
+\end_inset
+
@
\end_layout
@@ -11873,7 +12185,7 @@
Other Data Types
\begin_inset CommandInset label
LatexCommand label
-name "sub:Other-data-types"
+name "sub:other-data-types"
\end_inset
@@ -11884,7 +12196,7 @@
Features of Data Distributions
\begin_inset CommandInset label
LatexCommand label
-name "sec:Features-of-Data"
+name "sec:features-of-data"
\end_inset
@@ -12075,17 +12387,6 @@
\end_layout
\begin_layout Standard
-Introduced by Pearson in 1905
-\begin_inset Flex URL
-status collapsed
-
-\begin_layout Plain Layout
-
-http://jeff560.tripod.com/k.html
-\end_layout
-
-\end_inset
-
Another component to the shape of a distribution is how
\begin_inset Quotes eld
\end_inset
@@ -12158,7 +12459,7 @@
Clusters and Gaps
\begin_inset CommandInset label
LatexCommand label
-name "sub:Clusters-and-Gaps"
+name "sub:clusters-and-gaps"
\end_inset
@@ -13881,14 +14182,13 @@
\end_inset
-The first term in the formula is always nonnegative, so the sample excess
- kurtosis takes values
-\begin_inset Formula $-3\leq g_{2}<\infty$
+The sample excess kurtosis takes values
+\begin_inset Formula $-2\leq g_{2}<\infty$
\end_inset
.
- The subtraction of 3 may seem mysterious to the reader, but it is done
- so that mound shaped samples have values of
+ The subtraction of 3 may seem mysterious but it is done so that mound shaped
+ samples have values of
\begin_inset Formula $g_{2}$
\end_inset
@@ -14687,7 +14987,7 @@
Hinges and the Five Number Summary
\begin_inset CommandInset label
LatexCommand label
-name "sub:Hinges-and-the"
+name "sub:hinges-and-5NS"
\end_inset
@@ -14871,7 +15171,7 @@
Boxplots
\begin_inset CommandInset label
LatexCommand label
-name "sub:Boxplots"
+name "sub:boxplots"
\end_inset
@@ -15054,6 +15354,107 @@
R
\end_layout
+\begin_layout Standard
+The quickest way to visually identify outliers is with a boxplot, described
+ above.
+ Another way is with the
+\color none
+
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+boxplot.stats
+\end_layout
+
+\end_inset
+
+ function.
+\end_layout
+
+\begin_layout Example
+The
+\color none
+
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+rivers
+\end_layout
+
+\end_inset
+
+ data.
+ We will look for potential outliers in the
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+rivers
+\end_layout
+
+\end_inset
+
+ data.
+\end_layout
+
+\begin_deeper
+\begin_layout Scrap
+<<>>=
+\begin_inset Newline newline
+\end_inset
+
+boxplot.stats(rivers)$out
+\begin_inset Newline newline
+\end_inset
+
+@
+\end_layout
+
+\begin_layout Standard
+We may change the
+\color none
+
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+coef
+\end_layout
+
+\end_inset
+
+
+\color inherit
+ argument to 3 (it is 1.5 by default) to identify suspected outliers.
+\end_layout
+
+\begin_layout Scrap
+<<>>=
+\begin_inset Newline newline
+\end_inset
+
+boxplot.stats(rivers, coef = 3)$out
+\begin_inset Newline newline
+\end_inset
+
+@
+\end_layout
+
+\end_deeper
\begin_layout Subsection
Standardizing variables
\end_layout
@@ -15061,7 +15462,53 @@
\begin_layout Standard
It is sometimes useful to compare data sets with each other on a scale that
is independent of the measurement units.
- The
+ Given a set of observed data
+\begin_inset Formula $x_{1}$
+\end_inset
+
+,
+\begin_inset Formula $x_{2}$
+\end_inset
+
+, \SpecialChar \ldots{}
+,
+\begin_inset Formula $x_{n}$
+\end_inset
+
+ we get
+\begin_inset Formula $z$
+\end_inset
+
+ scores, denoted
+\begin_inset Formula $z_{1}$
+\end_inset
+
+,
+\begin_inset Formula $z_{2}$
+\end_inset
+
+, \SpecialChar \ldots{}
+,
+\begin_inset Formula $z_{n}$
+\end_inset
+
+, by means of the following formula
+\begin_inset Formula \[
+z_{i}=\frac{x_{i}-\xbar}{s},\quad i=1,\,2,\,\ldots,\, n.\]
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+How to do it with
+\family sans
+R
+\end_layout
+
+\begin_layout Standard
+The
\color none
\begin_inset listings
@@ -15076,8 +15523,11 @@
\end_inset
- function will rescale a numeric vector (or data frame) by subtracting the
- sample mean from each value (column) and/or
+
+\color inherit
+function will rescale a numeric vector (or data frame) by subtracting the
+ sample mean from each value (column) and/or by dividing each observation
+ by the sample standard deviation.
\end_layout
\begin_layout Section
@@ -15146,11 +15596,11 @@
We display the measured information in a rectangular array in which each
row corresponds to a subject, and the columns contain the measurements
for each respective variable.
- For instance, if one were to measure the height and weight of each of 11
- persons in a research study, the information could be represented with
- a rectangular array.
+ For instance, if one were to measure the height and weight and hair color
+ of each of 11 persons in a research study, the information could be represented
+ with a rectangular array.
There would be 11 rows.
- Each row would have the person's height in the first column and weight
+ Each row would have the person's height in the first column and hair color
in the second column.
\end_layout
@@ -15222,6 +15672,7 @@
and we want to make a data frame out of them.
\end_layout
+\begin_deeper
\begin_layout Scrap
<<>>=
\begin_inset Newline newline
@@ -15235,13 +15686,14 @@
\begin_inset Newline newline
\end_inset
-data.frame(x,y)
+A <- data.frame(v1 = x, v2 = y)
\begin_inset Newline newline
\end_inset
@
\end_layout
+\end_deeper
\begin_layout Standard
Notice that
\color none
@@ -15319,7 +15771,7 @@
\color inherit
is a character vector.
We may choose numeric and character vectors (or even factors) for the columns
- of the dataframe, but each column must be of exactly one type.
+ of the data frame, but each column must be of exactly one type.
That is, we can have a column for
\color none
@@ -15391,6 +15843,220 @@
(character or factor) information in the same column.
\end_layout
+\begin_layout Standard
+Indexing of data frames is similar to indexing of vectors.
+ To get the entry in row
+\begin_inset Formula $i$
+\end_inset
+
+ and column
+\begin_inset Formula $j$
+\end_inset
+
+ do
+\color none
+
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+A[i,j]
+\end_layout
+
+\end_inset
+
+.
+ We can get entire rows and columns by omitting the other index.
+
+\color inherit
+
+\end_layout
+
+\begin_layout Scrap
+<<>>=
+\begin_inset Newline newline
+\end_inset
+
+A[3,]
+\begin_inset Newline newline
+\end_inset
+
+A[1, ]
+\begin_inset Newline newline
+\end_inset
+
+A[ ,2]
+\begin_inset Newline newline
+\end_inset
+
+@
+\end_layout
+
+\begin_layout Standard
+There are several things happening above.
+ Notice that
+\color none
+
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+A[3,]
+\end_layout
+
+\end_inset
+
+ gave a data frame (with the same entries as the third row of
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+A
+\end_layout
+
+\end_inset
+
+)
+\color inherit
+yet
+\color none
+
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+A[1, ]
+\end_layout
+
+\end_inset
+
+ is a numeric vector.
+
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+A[ ,2]
+\end_layout
+
+\end_inset
+
+ is a factor vector because the default setting for
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+data.frame
+\end_layout
+
+\end_inset
+
+ is
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+stringsAsFactors = TRUE
+\end_layout
+
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Standard
+Data frames have a
+\color none
+
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+names
+\end_layout
+
+\end_inset
+
+ attribute and the names may be extracted with the
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+names
+\end_layout
+
+\end_inset
+
+ function.
+ Once we have the names we may extract given columns by way of the dollar
+ sign.
+\end_layout
+
+\begin_layout Scrap
+<<>>=
+\begin_inset Newline newline
+\end_inset
+
+names(A)
+\begin_inset Newline newline
+\end_inset
+
+A$v1
+\begin_inset Newline newline
+\end_inset
+
+@
+\end_layout
+
+\begin_layout Standard
+The above is identical to
+\color none
+
+\begin_inset listings
+lstparams "showstringspaces=false"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+A[ ,1]
+\end_layout
+
+\end_inset
+
+.
+
+\color inherit
+
+\end_layout
+
\begin_layout Subsection
Bivariate Data
\begin_inset CommandInset label
@@ -15454,6 +16120,36 @@
\end_layout
+\begin_deeper
+\begin_layout Itemize
+carb ~ optden, data = Formaldehyde
+\end_layout
+
+\begin_layout Itemize
+conc ~ rate, data = Puromycin
+\end_layout
+
+\begin_layout Itemize
+xyplot(accel ~ dist, data = attenu) nonlinear association
+\end_layout
+
+\begin_layout Itemize
+xyplot(eruptions ~ waiting, data = faithful) (linear, two groups)
+\end_layout
+
+\begin_layout Itemize
+xyplot(Petal.Width ~ Petal.Length, data = iris)
+\end_layout
+
+\begin_layout Itemize
+xyplot(pressure ~ temperature, data = pressure) (exponential growth)
+\end_layout
+
+\begin_layout Itemize
+xyplot(weight ~ height, data = women) (strong positive linear)
+\end_layout
+
+\end_deeper
\begin_layout Subsection
Multivariate Data
\begin_inset CommandInset label
@@ -15524,7 +16220,7 @@
\end_layout
\begin_layout Itemize
-Scatterplot Matrix.
+Scatterplot matrix.
used for displaying pairwise scatterplots simultaneously.
Again, look for linear association and correlation.
\end_layout
@@ -15724,26 +16420,207 @@
\end_layout
\begin_layout Itemize
+Bar Graphs
+\end_layout
+
+\begin_deeper
+\begin_layout Itemize
+plot(xtabs(Freq ~ Admit + Gender, data = UCBAdmissions)) # rescaled barplot
+\end_layout
+
+\begin_layout Itemize
+barplot(xtabs(Freq ~ Admit + Gender, data = UCBAdmissions)) # stacked bar
+ chart
+\end_layout
+
+\begin_layout Itemize
+barplot(xtabs(Freq ~ Admit, data = UCBAdmissions))
+\end_layout
+
+\begin_layout Itemize
+barplot(xtabs(Freq ~ Gender + Admit, data = UCBAdmissions), legend = TRUE,
+ beside = TRUE) # oops, discrimination.
+\end_layout
+
+\begin_layout Itemize
+barplot(xtabs(Freq ~ Admit+Dept, data = UCBAdmissions), legend = TRUE, beside
+ = TRUE) # different departments have different standards
+\end_layout
+
+\begin_layout Itemize
+barplot(xtabs(Freq ~ Gender+Dept, data = UCBAdmissions), legend = TRUE,
+ beside = TRUE) # men mostly applied to easy departments, women mostly applied
+ to difficult departments
+\end_layout
+
+\begin_layout Itemize
+barplot(xtabs(Freq ~ Gender+Dept, data = UCBAdmissions), legend = TRUE,
+ beside = TRUE)
+\end_layout
+
+\begin_layout Itemize
+barchart(Admit ~ Freq, data = C)
+\end_layout
+
+\begin_layout Itemize
+barchart(Admit ~ Freq|Gender, data = C)
+\end_layout
+
+\begin_layout Itemize
+barchart(Admit ~ Freq | Dept, groups = Gender, data = C)
+\end_layout
+
+\begin_layout Itemize
+barchart(Admit ~ Freq | Dept, groups = Gender, data = C, auto.key = TRUE)
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
Histograms
\end_layout
+\begin_deeper
\begin_layout Itemize
+~ breaks | wool*tension, data = warpbreaks
+\end_layout
+
+\begin_layout Itemize
+~ weight | feed, data = chickwts
+\end_layout
+
+\begin_layout Itemize
+~ weight | group, data = PlantGrowth
+\end_layout
+
+\begin_layout Itemize
+~ count | spray, data = InsectSprays
+\end_layout
+
+\begin_layout Itemize
+~ len | dose, data = ToothGrowth
+\end_layout
+
+\begin_layout Itemize
+~ decrease | treatment, data = OrchardSprays (or rowpos or colpos)
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
Scatterplots
\end_layout
+\begin_deeper
\begin_layout Itemize
+xyplot(Petal.Width ~ Petal.Length, data = iris, group = Species)
+\end_layout
+
+\begin_layout Scrap
+<<eval = FALSE>>=
+\begin_inset Newline newline
+\end_inset
+
+library(lattice)
+\begin_inset Newline newline
+\end_inset
+
+xyplot()
+\begin_inset Newline newline
+\end_inset
+
+@
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
Scatterplot matrices
\end_layout
+\begin_deeper
\begin_layout Itemize
+splom(~ cbind(GNP.deflator,GNP,Unemployed,Armed.Forces,Population,Year,Employed),
+ data = longley)
+\end_layout
+
+\begin_layout Itemize
+splom(~ cbind(pop15,pop75,dpi), data = LifeCycleSavings)
+\end_layout
+
+\begin_layout Itemize
+splom(~ cbind(Murder, Assault, Rape), data = USArrests)
+\end_layout
+
+\begin_layout Itemize
+splom(~ cbind(CONT, INTG, DMNR), data = USJudgeRatings)
+\end_layout
+
+\begin_layout Itemize
+splom(~ cbind(area,peri,shape,perm), data = rock)
+\end_layout
+
+\begin_layout Itemize
+splom(~ cbind(Air.Flow, Water.Temp, Acid.Conc., stack.loss), data = stackloss)
+\end_layout
+
+\begin_layout Itemize
+splom(~ cbind(Fertility,Agriculture,Examination,Education,Catholic,Infant.Mortali
+ty), data = swiss)
+\end_layout
+
+\begin_layout Itemize
+splom(~ cbind(Fertility,Agriculture,Examination), data = swiss) (positive
+ and negative)
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
Dot charts
\end_layout
+\begin_deeper
\begin_layout Itemize
-Plot of means
+dotchart(USPersonalExpenditure)
\end_layout
\begin_layout Itemize
+dotchart(t(USPersonalExpenditure))
+\end_layout
+
+\begin_layout Itemize
+dotchart(WorldPhones) (transpose is no good)
+\end_layout
+
+\begin_layout Itemize
+freeny.x is no good, neither is volcano
+\end_layout
+
+\begin_layout Itemize
+dotchart(UCBAdmissions[,,1])
+\end_layout
+
+\begin_layout Itemize
+dotplot(Survived ~ Freq | Class, groups = Sex, data = B)
+\end_layout
+
+\begin_layout Itemize
+dotplot(Admit ~ Freq | Dept, groups = Gender, data = C)
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
+Mosaic plot
+\end_layout
+
+\begin_deeper
+\begin_layout Itemize
+mosaic(~ Survived + Class + Age + Sex, data = Titanic) (or just mosaic(Titanic))
+\end_layout
+
+\begin_layout Itemize
+mosaic(~ Admit + Dept + Gender, data = UCBAdmissions)
+\end_layout
+
+\end_deeper
+\begin_layout Itemize
Quantile-quantile plots: There are two ways to do this.
One way is to compare two independent samples (of the same size).
qqplot(x,y).
@@ -16181,7 +17058,12 @@
\end_layout
-\begin_layout Section
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section*
Chapter Exercises
\end_layout
@@ -16193,6 +17075,13 @@
\backslash
+addcontentsline{toc}{section}{Chapter Exercises}
+\end_layout
+
+\begin_layout Plain Layout
+
+
+\backslash
setcounter{thm}{0}
\end_layout
@@ -16442,7 +17331,7 @@
status open
\begin_layout Paragraph*
-Answers:
+Answer:
\end_layout
\begin_layout Scrap
@@ -16805,6 +17694,7 @@
\end_deeper
\end_deeper
\begin_layout Standard
+\noindent
\begin_inset Branch solutions
status open
@@ -18008,7 +18898,12 @@
\end_layout
\begin_layout Standard
-In this chapter, we define the basic terminology associated with probability
+\begin_inset Branch main
+status open
+
+\begin_layout Standard
+\noindent
+In this chapter we define the basic terminology associated with probability
and derive some of its properties.
We discuss three interpretations of probability.
We discuss conditional probability and independent events, along with Bayes'
@@ -25309,7 +26204,7 @@
\begin_layout Standard
\begin_inset listings
-lstparams "basicstyle={\ttfamily},breaklines=true,frame=leftline,showstringspaces=false,tabsize=2"
+lstparams "basicstyle={\ttfamily},breaklines=true,showstringspaces=false,tabsize=2"
inline false
status open
@@ -27962,7 +28857,7 @@
data set in Chapter
\begin_inset CommandInset ref
LatexCommand ref
-reference "cha:An-Introduction-to-R"
+reference "cha:introduction-to-R"
\end_inset
@@ -30965,7 +31860,12 @@
\end_layout
-\begin_layout Section
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section*
Chapter Exercises
\end_layout
@@ -30977,6 +31877,13 @@
\backslash
+addcontentsline{toc}{section}{Chapter Exercises}
+\end_layout
+
+\begin_layout Plain Layout
+
+
+\backslash
setcounter{thm}{0}
\end_layout
@@ -31104,6 +32011,11 @@
\end_layout
\begin_layout Standard
+\begin_inset Branch main
+status open
+
+\begin_layout Standard
+\noindent
In this chapter we introduce discrete random variables, those who take values
in a finite or countably infinite support set.
We discuss probability mass functions and some special expectations, namely,
@@ -31118,7 +32030,7 @@
a fundamental role with respect to re sampling and Chapter
\begin_inset CommandInset ref
LatexCommand ref
-reference "cha:Resampling-Methods"
+reference "cha:resampling-methods"
\end_inset
@@ -33726,7 +34638,14 @@
plotted
\emph default
, which will return graphs of the PMF, CDF, and quantile function (introduced
- in Section ).
+ in Section
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "sub:Normal-Quantiles-QF"
+
+\end_inset
+
+).
See Figure
\begin_inset CommandInset ref
LatexCommand ref
@@ -35347,7 +36266,7 @@
) or resampling (see Chapter
\begin_inset CommandInset ref
LatexCommand ref
-reference "cha:Resampling-Methods"
+reference "cha:resampling-methods"
\end_inset
@@ -35625,7 +36544,7 @@
\begin_inset CommandInset ref
LatexCommand ref
-reference "cha:Resampling-Methods"
+reference "cha:resampling-methods"
\end_inset
@@ -37307,15 +38226,25 @@
\end_inset
.
-
+ A
+\emph on
+Poisson process
+\emph default
+
+\begin_inset Index
+status open
+
+\begin_layout Plain Layout
+Poisson process
\end_layout
-\begin_layout Paragraph*
-Assumptions:
+\end_inset
+
+ satisfies the following conditions:
\end_layout
\begin_layout Itemize
-The probability of an event occurring in a particular subinterval is
+the probability of an event occurring in a particular subinterval is
\begin_inset Formula $\approx\lambda/n$
\end_inset
@@ -37323,7 +38252,7 @@
\end_layout
\begin_layout Itemize
-The probability of two or more events occurring in any subinterval is
+the probability of two or more events occurring in any subinterval is
\begin_inset Formula $\approx0$
\end_inset
@@ -37450,7 +38379,7 @@
Functions of Discrete Random Variables
\begin_inset CommandInset label
LatexCommand label
-name "sec:Functions-of-Discrete"
+name "sec:functions-discrete-rvs"
\end_inset
@@ -38204,7 +39133,12 @@
\end_layout
-\begin_layout Section
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section*
Chapter Exercises
\end_layout
@@ -38216,6 +39150,13 @@
\backslash
+addcontentsline{toc}{section}{Chapter Exercises}
+\end_layout
+
+\begin_layout Plain Layout
+
+
+\backslash
setcounter{thm}{0}
\end_layout
@@ -38224,7 +39165,7 @@
\end_layout
-\begin_layout Enumerate
+\begin_layout Exercise
A recent national study showed that approximately 44.7% of college students
have used Wikipedia as a source in at least one of their term papers.
Let
@@ -38802,6 +39743,11 @@
\end_layout
\begin_layout Standard
+\begin_inset Branch main
+status open
+
+\begin_layout Standard
+\noindent
The focus of the last chapter was on random variables whose support can
be written down in a list of values (finite or countably infinite), such
as the number of successes in a sequence of Bernoulli trials.
@@ -38882,7 +39828,7 @@
Continuous Random Variables
\begin_inset CommandInset label
LatexCommand label
-name "sec:Continuous-Random-Variables"
+name "sec:continuous-random-variables"
\end_inset
@@ -38893,7 +39839,7 @@
Probability Density Functions
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/ipsur -r 179
More information about the IPSUR-commits
mailing list