Discussion section attendance is mandatory for students taking the class for 5 units.
Now fixed as:
Monday 5, Room 60-61A (Inner quad, Archaelogy building)
Tuesday 3, Room 540-108 (Earthquake engineering)
Wednesday 5, Room 60-61A (Inner quad, Archaelogy building)
Second R Labs: Thursday Oct.21 at 4.00pm and Friday, Oct. 22 at 2.00pm in Sequoia 211.
Forth R Labs: Thursday November 18th at 3.15 and Friday November 19th at 2.00pm
If you are having trouble using either the install.packages command or downloading the binary from its original website (http://cran.r-project.org/src/contrib/Descriptions/ISwR.html), you can cut and paste the file from a text file saving the text file locally on your computer (say as kfm.txt) and making sure you give the right path to it type in R:
kfm=read.table('/Users/susan/Desktop/kfm.txt',header=T) [for a mac]
or
kfm=read.table('C:\MyFiles\kfm.txt',header=T) [for a pc]
Link to the file:kfm.txt
There is also a link to the file:kfm.save
if you choose to use that file, all you need to do is write:
load('C:\MyFiles\kfm.save') [for a pc]
or
load('/Users/susan/Desktop/kfm.save') [for a mac]
The commercial version is called Splus and is also available from leland machines, at our level there are no differences between the two and the documentations are interchangeable.
Elizabeth Purdom's R Help Pages
After downloading X11 from the Apple website at http://www.apple.com/macosx/x11/download/
setenv display [ip address]:0.0 [return]
for example:
elaine0:~> setenv display 171.23 45.789:0.0
7) start R
8) switch over to the mix window on your computer, and R will be
displayed there, complete with menus, graphics, etc.
9) yes!
note: if mix quits when you start R, open the mix preferences by left
clicking on the mix icon in the upper left corner, open the tab called
"other" and make sure "exit when all windows closed" is not checked.
To install to another tree (e.g., your private one), use $ R CMD INSTALL -l lib pkg_version.tar.gz where lib gives the path to the library tree to install to. To use them you have to have installed a variable: R_LIBS="$HOME/lib/R:/usr/local/lib/R-contrib"; export R_LIBS You can directly indicate a path for instance in R write: > library(ISwR,lib.loc='/afs/ir/class/stats141/lib/') will enable to load the library from the class directory.
Class attendanceAttendance is compulsory.
General instructions:
Do not give them in late because the solutions
will be posted on the web, so there will be NO credit
for late homeworks.
If you are having trouble with a lecture or
a homework, come to office hours
as soon as possible.
Many trouble students have
is due to backlog.
If you cannot do all of a problem, you should
still hand in what you have done.
Do the following problems from the book: 2.36, 2.56, 2.60, 2.63, 2.74 (should include any graphs used), 2.77.
Here is the text with the data of some of these so you can cut and
paste:
Here are the 20 measurements of preening time reported in Exercise
2.12 for 2.63:
34 24 10 16 52
76 33 31 46 24
18 26 57 32 25
48 22 48 29 19
a. Determine the median and the quartiles.
b. Determine the interquartile range.
c. Construct a (modified) boxplot of the data.
2.74
The carbon monoxide in cigarettes is thought to be hazardous to the
fetus of a pregnant woman who smokes. In a study of this theory, blood
drawn from pregnant women before and after smoking a
cigarette. Measurements were made of the percent of blood hemoglobin
bound to carbon monoxide as carboxyhemoglobin (COHb). The results for
ten women are shown the table.
Blood COHb (%)
Subject Before After Increase
1 1.2 7.6 6.4
2 1.4 4.0 2.6
3 1.5 5.0 3.5
4 2.4 6.3 3.9
5 3.6 5.8 2.2
6 0.5 6.0 5.5
7 2.0 6.4 4.4
8 1.5 5.0 3.5
9 1.0 4.2 3.2
10 1.7 5.2 3.5
a. Calculate the mean and standard deviation of the INCREASE in COHb.
b. Calculate the mean COHb before and the mean after. Is the mean
increase equal to the increase in means?
c. Construct a stem-and-leaf diagram of the increase in COHb. Use the
diagram to determine the median increase.
colonies groups 6 soap 16 soap 26 soap 27 soap 30 soap 46 soap 76 soap 21 control 30 control 35 control 36 control 38 control 45 control 63 control 66 control7.38:fertiliz.txt (save to file and use fertiliz=read.table('fertiliz.txt',header=T))
height group 3.4 control 4.4 control 3.5 control 2.9 control 2.7 control 2.6 control 3.7 control 2.7 control 2.3 control 2 control 1.8 control 2.3 control 2.4 control 2.5 control 1.6 control 2.9 control 2.3 control 2.8 control 2.5 control 2.3 control 1.6 control 1.6 control 3 control 2.3 control 3.2 control 2 control 2.6 control 2.4 control 2.8 fertilized 1.9 fertilized 3.6 fertilized 1.2 fertilized 2.4 fertilized 2.2 fertilized 3.6 fertilized 1.2 fertilized 0.9 fertilized 1.5 fertilized 2.4 fertilized 1.7 fertilized 1.4 fertilized 1.8 fertilized 1.9 fertilized 2.7 fertilized 2.3 fertilized 1.8 fertilized 2.7 fertilized 2.6 fertilized 1.3 fertilized 3 fertilized 1.4 fertilized 1.2 fertilized 2.6 fertilized 1.8 fertilized 1.7 fertilized 1.5 fertilized7.51: hypnosis.txt (save to file and use hypnosis=read.table('hypnosis.txt',header=T))
liters group 5.32 experimental 5.60 experimental 5.74 experimental 6.06 experimental 6.32 experimental 6.34 experimental 6.79 experimental 7.18 experimental 4.50 control 4.78 control 4.79 control 4.86 control 5.41 control 5.70 control 6.08 control 6.21 control
(a) Construct the ANOVA table and carry out the
test at
.
(b) Assuming that each of the four populations has the same standard
deviation, use the data to calculate an estimate of that standard deviation.
(c) Prepare an interaction graph.
Inhaled Zanamivir: mean = 5.4, SD = 2.7, n = 85
Inhaled intranasal Zanamivir: mean = 5.3, SD = 2.8, n = 88
Placebo: mean = 6.3, SD = 2.9, n = 89
(a) State the null hypothesis in words, in the context of this setting.
(b) State the null hypothesis in symbols.
(c) Construct the ANOVA table and test the null hypothesis. Let
.
(d)Calculate the pooled standard deviation,
.
Group WtGain Control 41.0 Control 38.4 Control 24.9 .... Ozone 44.1 Ozone -9.0 Ozone -9.0
Use the command
ozone=read.table(``www-stat.stanford.edu/~susan/courses/s141/RATOZONE.txt'',header=T)
to download the data.
Length Sample 5.4 1 5.3 1 5.2 1 4.5 1 .... 5.1 5 4.8 5 4.9 5
Use the command
pigeon=read.table(``http://www-stat.stanford.edu/~susan/courses/s141/pigeon.dat'',header=T)
to download the data.
What problems might there be with this ANOVA setup?
Compare ANOVA results with those obtained using Kruskal-Wallis test by
typing:
kruskal.test(survival~experiment,data=goldfish.df).
Experiment 1 210 180 240 210 210 Experiment 2 150 180 210 240 240 120 180 240 120 150 Salts Added 330 300 300 420 360 270 360 360 300 120
Enter the data using a cut and paste of the following:
survival=c(210, 180, 240, 210, 210,
150, 180, 210, 240, 240, 120, 180, 240, 120, 150,
330, 300, 300, 420, 360, 270, 360, 360, 300, 120)
experiment=factor(c(rep('expt1',5),rep('expt2',10),rep('expt3',10)))
goldfish.df=data.frame(survival,experiment)
Problems: 12.3,12.19, 12.4, 12.13, 12.5,12.14 from the text.