michael 2007-8-22 12:53
Modern Applied Statistics with S-Plus
Contents
_~a{B5u}
1 Starting R 4
+`_%hdz~T4Sh?
1.1 Installing R . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
!H
FU8o5P T|
1.2 Basic R Commands . . . . . . . . . . . . . . . . . . . . . . . 4
W;r"T!t{a}c
n%p
1.3 An Example of an R Session . . . . . . . . . . . . . . . . . . 4
T DqxK
2 Objects in R 6Qv a,[&c2j7i
2.1 Vectors and matrices . . . . . . . . . . . . . . . . . . . . . . . 6&iI"F'Y[]-U7z
2.2 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70A,czKC8\l'r
2.3 Factors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8\Jgs}gcx.K
2.4 Data frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
JW
w!S^;]r)~
2.5 Homework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
C9kPB+j2H
3 Functions 10
x7F!F t,oOU~$`
3.1 Built-in functions . . . . . . . . . . . . . . . . . . . . . . . . . 10IRu
U
Q a w
3.2 Writing functions . . . . . . . . . . . . . . . . . . . . . . . . . 11
j1g,j(J!ob
3.3 Plotting functions . . . . . . . . . . . . . . . . . . . . . . . . 135B/D1m.J\uEre
3.4 Home Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
:}~5_1}s.]o8L
4 Linear models 14
!J&e A.\ ~
{2iS)A
4.1 A simple regression example . . . . . . . . . . . . . . . . . . 14
X|FFs|"M/K*py*?
4.2 Model formulae . . . . . . . . . . . . . . . . . . . . . . . . . . 14
"[j_4T9[(Q7E
4.3 Diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
z8}1G+x
N[
4.4 Model selection . . . . . . . . . . . . . . . . . . . . . . . . . . 17
n8AAIx
4.5 Homework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
%~0]
J h3^EG`jY1B
1&`'bsLuUn:V8f
5 Generalized Linear Models (GLM) 19
T$`1V{(q`| q-{B
5.1 The basic model . . . . . . . . . . . . . . . . . . . . . . . . . 19
P.r+`+F5^qj$p
5.2 Analysis of deviance . . . . . . . . . . . . . . . . . . . . . . . 20
E2r8pI6|3_
5.3 Fitting the model . . . . . . . . . . . . . . . . . . . . . . . . . 21
CtP1V7n"C%P%M.y
5.4 Generic functions and method functions . . . . . . . . . . . . 21
X
Je8C(V"VF
5.5 A small Binomial example . . . . . . . . . . . . . . . . . . . . 21
i'EI+@a
5.6 Fitting other families . . . . . . . . . . . . . . . . . . . . . . . 23r/Cf$a$^8a8P
5.7 Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23m7s+]
XtMb
5.8 A Poisson example . . . . . . . . . . . . . . . . . . . . . . . . 23!Qb/K
|A;Lk\T
5.9 Home Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
&k l5s8lD&~~}U
L7]
6 Robust methods 26v;A-w3m7T'FC
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26c x%k`+~"kY GED
6.2 The lqs function for resistant regression . . . . . . . . . . . 26
9qnkmO}
6.3 Some examples . . . . . . . . . . . . . . . . . . . . . . . . . . 28,u qPy3}:{D7?g
6.4 Home work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31!JM_i'D}h;R'_
7 Non-linear Regression 33z:v"o#w m4j U
7.1 The basic model . . . . . . . . . . . . . . . . . . . . . . . . . 33
Gz"R2{M6f+Q'{O
K
7.2 A small example . . . . . . . . . . . . . . . . . . . . . . . . . 33qdVsKL2wVn
7.3 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35nJWx7k
k
7.4 Prediction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35&r-r}.a6BGTMF4Z
7.5 Pro les . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
[9~)O,qoeS
7.6 Home work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
CG.^
qX,A!P3z
8 Non-parametric and semi-parametric Regression 40
-G4rT!x
c6a
8.1 Non-parametric smoothing . . . . . . . . . . . . . . . . . . . 40
9w^J/q2n Y\
8.2 The projection-pursuit model . . . . . . . . . . . . . . . . . . 41
j@TA$x)H*G;i
8.3 A simulated example of PP-regression . . . . . . . . . . . . . 42U} }F`
8.4 Home work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
+E QT*gffp
9 Tree-based models 45wEF E'[`5Y*fp
9.1 An example of a regression tree . . . . . . . . . . . . . . . . 46$B'I y az-X
9.2 An example of a classi cation tree . . . . . . . . . . . . . . . 49
!x-kq5bt ys1j1p#h
9.3 Homework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526{"TarN(_;n~
10 Multivariate analysis 53$r:I9dAB)d
10.1 Multivariate data . . . . . . . . . . . . . . . . . . . . . . . . . 53
3t1x5BLJr B,g
10.2 Graphical methods . . . . . . . . . . . . . . . . . . . . . . . . 54R'w'lnMU I
10.3 Principal components analysis . . . . . . . . . . . . . . . . . 54
BrC wC\/^/f-oimx
2
G8`;H
J9uX$pM
10.4 cluster analysis . . . . . . . . . . . . . . . . . . . . . . . . . . 55
CMs$y-R,q8dqa
10.5 Home work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57*a4o.s
^$azy:B%k
10.6 Classi cation . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
x5{'N6g4]+b-_
10.7 Multivariate linear models . . . . . . . . . . . . . . . . . . . . 64@'Gvk?M:O
10.8 Canonical correlations . . . . . . . . . . . . . . . . . . . . . . 65
*S!bP y+yo
10.9 Project 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66