CNwt
QwBU=@a
Qmi
C
O}yW
=
=Q u H
xm
jQ@ w ?
= x@
u s v
CavY
x=oWv=O
|Q t C U t u @ R @ } W =
=@
=L
=
=
| =v
R 122
CU=Q} w
|vWwOv|wUwt O}aUO}U
[email protected] 1390 Q @ =y
? =] C Qy r
t
U
R |U} wvxt=vQ@ u=@ R =@ |}=vW pw= pYi
1 1 1 3 3 4 5 7 7 7 9 9 10 10 11 11 11
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
.. .. .. .. .. .. .. .. .. .. .. .. .. .= .. ..
. . . . . . . . . . . .
. . . . . . . .
i
. . . . . . . . . . . . . . . . . . . . . . . x Ok . . . . . . . . . . . . . . . . |U w x = Q = Q . . . . . . . . . . . . . . . . . . R Q ?Y Q
t
1 1
} v t v @ u @R = J
21
t
Q= i=s v
x_i=L
=}
...... ...... ...... ...... read.table . . . scan ....... .......
=yxO=O
yxO=O R=
Q
P
QO < W= uO m h L w
. . . .
. . . .
.. R = = ......R R = = . . p= =
=H}=
131
QoW}=Q} w
231
=yxO=O
331
=
431
'O
u @R | y
QO
u @ R QO xO t | yxO=O } i R=
O w
O w
wDUO
1531
O w
wDUO
2531
u v= N Q
. . . p= = ........ = } i |wQ
yxO=O
uDWwv
631
O}rwD
731
yxO=O
| y r vO O
= x =@
=H}=
1731
|iO=YD
| y r vO O
= x =@
=H}=
2731
..................... = .................. = Q
=D =
yxO=O Q N U
yQ=O @
hr=
31
531
yxO=O u v= N
u v= N Q
s_vt
R=
CUQyi
v R ]
141
41
12 14 18 19 20 20 21 22 22 23 24 25 25 26 27 28 29 29 30
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .Q
. . . . . . . . . . . . . . . . . .
=yQ=OQ@
. . . . . . . . . . . . . . . . .
=
. . . .
|wQ
|=} Q
=@ =Lt
1141
C U
............... . | l =D = O =W .. =}rt T Q= .......... w = W
t
1241
} D t
2241
} Q N U x y
u C
a w
w
O
241
=
341
Q=O? JQ J | yxO=O
=
=
w
1341
Q=O? JQ J | yxO=O X= N
. . . . . . . . . . . .
=yT} QD=t
w
=
=
Q=O? JQ J | yxO=O O
@Q m x W
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
2341
. . . . . . . . factor() ` = . . . |= Q = C w w . . . . . . . . . . = C Qy v tR | U | y
@ D
441
}O H t
541
y
CUQyi O=H}=
. . . .
. . . .
. . . .
. . . .
. . . .
=@
. . . .
. . . .
U
1641
. . . .
. . . .
. . . .
.R = = .. Q . . xkr .. `w u @R
@
151
L
251
@= D
351
: : : u t oQ
= w
2351
= Q}eDt
3351
h} QaD Qorta l} CN=U
4351
t | y
|U} wvxt=vQ@
\ W
1351
w |Q H= u t oQ
..... . . . . |rL
641
i
= w
|Q
=}DN=
. . . . . . . .
=H}=
Q=Owtv
32 32 34 36 37 37 39 40 42
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
............... . . . . . . . . curve() ` = ...... = wt ` w
|Q=O
@ D
112
@= D
212
= CtUk
312
wtv OvJ
412
= s |m}i=Qo xQHvB OvJ O=H}=
512
|Q t |Q=O
s}UQD xLiY uwo =vwo
..
xLiY l}
v
| y
|wQ Q=O
u tR y
...... | . . . u} = K]
=
= s}_vD
} B
U
`@=wD
52 53 55
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
=
p=tDL= w Q=t swU pYi
iO
D O= a= w s= o
?
y
r
=
|Q t
x}=B `@=wD
@= D
113
L= | y } R D
213
O }R | @Q m
@
12
712
R= |=xQ B
................ ........ = Q = =`w . | =Y O | =tD = ` w . . . . Q wDU}
sUQ swO pYi
612
HQ N | y
52 52
wtv `@=wD
51
1213
13
56 58 59 60 62 64 65 65
. . . . . . . .
. . . . . . . .
. . . . . . . .
...... qqplot() ...... ...... ...... ...... ...... ......
. . . . . . = Q =tD | =o ` = qqline() qqnorm() |m} Q ` w . . . . . . . . . . . ecdf() ` = . . . . . . = = =tD | =o ` = ................ | . . . . . . . . . . =tD ` = l ................. . . . . . . txQ l w p t v p
w
L=
r
'
J
i= o
t o p
L=
r
J
@ D
2213
@= D
3213
@ D
4213
@ D
5213
=YD
iO
p
L=
i ] wO w
@ D
|
Q}oxvwtv
= QDt=Q=B
Q
OQw @
413
|Q t | yVwQ
513
} | y
} u tR
313
=
=
1513
uw}UQoQ |=ypOt sQ=yJ pYi
68 68 68 69 74 75
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . . . . . . . . |] w} ...... wQ =C w w ......... = O `w . O X}NW . =v}t xr = N u
p t i | y
}O H t
|R Up t
p t
u
]=
@= D
D
1214
Y i
2214
Q
=
O
U oQ | yp t
14
114 214
`H=Qt
77
G
pw= pYi
R |U w x = Q = = | =v } v t v @ u @R @
}
W
11
xtOkt
S-plus x}@ w Auckland =oW
=@ =Lt |=Q@ w |Q=t QwyWt |Q=Ri=sQv xDU@
C U
obert Gentleman
R
= = \U
u } k
D
=}U@ xm OW=@|t |=Qo|W |=} Q |U} wvxt=vQ@ u=@ R l}
WQ
x
=
Q
R
Q=L p=L QO "Ci=} |O=} R u}@]=Nt |OwR@ w OW `wQW "O}OQo ?=NDv= u |=Q@
R Q web xLi http://www.r-project.org %
CU= Q} R KQW x@
xSw B
Y
R
=
v=O Q t xw o QO 1995 p U R=
|v=Wv "O@=}|t xaUwD xv=@r]w=O w Ovm|t
Q CU= xOW |L=Q] |Q=t
xSw B "
= Cra u}ty x@ R
s v
=
\}Lt
QO
CU= TQDUO
"
|U} wvxt=vQ@ u=@ R x@ R=}v =QJ xm O}|t V}B
QO
R}v
w
p= U
spss, sas, Minitab, statistica,
Ov}mv Q=m x=}U x@aH l} =@ \ki
w
O}vm
lQO
|DUQO x@
|Q t
=
wtv
=Q |Q t
1
w
"O W
=
"O
"
u}=
u=
s}DQwor=
=Q
w
xov |rrtr=u}@ s}D l} =Q u=@ R u}=
xDN=OQB
hrDNt
wva
oss Ihaka
|Q=O
|U} wvxt=vQ@
|Q t
R
Q} R O
QDW}@
|
=
R
21
u=@ R =QJ
=} R
C } H
x@ xm u}=
p@k
R=
Q xm u}= ut 'OQ=O OwHw
| yQ= i=s v
w
w |t
OQ= t u= D
w p t 'VwQ
l}
w
p= U
=
T U=
u}= x@ MU=B
xm u}=
Q
|= @
Q
|= @
1390 '
|vWwOv|wUwt
2
O}W=@ xDW=O
"
package, extension
=Q
R
Q =}
|Q= i=s v
w
|
QDW}@ pQDvm OwN |HwQN
xt=vQ@ u=DOwN sD} Qwor= =} "
O}vmv xOvU@
=
w |Q t
=
O}OH
l}Uqm
|Q t
4 V=Dv}mt
Q
= H=
w
3 Tmwv}r '2 Tm}vw} '1 RwOv} w
= sDU}U
| y
|wQ w
OW=@|t R=@
=
Q O}y=wN@ Qo =
| yVwQ |= @
=
| yVwQ
"
O}y=wN@ Qo =
|wQ
x@ \ki
w
O}yO \U@
CU= Q} R KQW x@ u=@ R u}= uU=Lt = O
R
CU= u=o}=Q
u | y m w
=
u @R
w |t
"O W
CU= |@ wN |rN=O
"
=
u @R
=
CU=
"
=
package
| y
w
CU= |v=w=Qi
=
|Q t
S-plus
=HD u* =@ R =@ |}=vW xrRvt x@ u=@ R u}= =@ |}=vW
xDN=UV}B `@=wD
CU= |o}i=Qo x_Lqt p@=k
=tvy=Q
|=Q=O
= C}r@=k
|=Q=O
|
| y
=
CU=
|=Q=O w
=
Q}oO=} "CU=
xO U u |
CN=U
"
"
version 2.6.2 (2008-02-08)
version 2.7.0 (2008-04-22)
version 2.7.1 (2008-06-23)
version 2.7.2 (2008-08-25)
version 2.8.0 (2008-10-20)
version 2.8.1 (2008-12-22)
version 2.9.0 (2009-04-17)
version 2.9.1 (2009-06-26)
version 2.9.2 (2009-08-24)
version 2.10.0 (2009-10-26)
version 2.10.1 (2009-12-14)
version 2.11.0 (2010-04-22)
version 2.11.1 (2010-05-31) 2. Unix
=iDU=
u R=
O}vm xHwD Q} R KQW x@ p=Ft
1. Windows
xO
=Q
3. Linux
4. Macintosh
Q@ Q=m Q_v
w `@=wD
w |v=@ R '
| k
w |t xi==
wtv
R
* * |Q t |Q
"O W
"O
R
u @R
"
u
x@
R
=
u @R
=
=}U@
|O } R Q
w |t |oO=U x@ u=@ R u}=
QO
=@
wva x@ 'CU= x_Lqt p@=k u=@ R u}=
x_i=L QO
O |twRr
wDUO |y=Dwm Cra x@
"OQ= v
C=Q
|
Oa@
= Q]U x@ uDiQ 'Q}N= p=Ft
| y
R u=@ R xO
=iDU= QoW}=Q} w l}
xm CU= ?U=vt w CU= xOvvmxDUN
R=
O w |t s}UkD xDUO
" v W
=D
xO
wtv l}rm
=
OO
Qy
=Q O N
R @ | } H
w
|va}
R
wm}
u
xLiY Q_v
R
R Console
= O
|
w |t uwvm = "CU= xOW xDWwv
QO
xm CU= |i=m =yO)m O}vR@
=Q
Q
Q
Q Q
m w xO
=
RGui wvt
|q @ |
QO
w
O N
Oa@
wtv A}=D
=Q
w O
w
QO "O W
pN=O QoW}=Q} w l}
TBU
R Untitled - R Editor
|= H= |= @ "O m = H=
Enter O}r
xLiY
R=
=@ |}=yp}=i =yQoW}=Q} w
B
= O Qo =
| y ) m
w
Q
R
Q
w O W = H= Q= i=s v
= xm OwW|t
u |q @
wtv xQ}NP TBU w CWwv OvDUy xm =DOvJ
Q} R QwDUO
w
Ctqa xm |}=H
'OQ=O O Hw >
source("le name") =F
wva x@
wtv xi== R}v
"O
=Q
Q}Ut
TQO
O}=@ p}=i s=v Q@
qa x=ov
xw
'O
w@v
=
|Q H
xWwB
QO
p}=i Qo =
source("E:/users/test.r")
download qkDU O = OvDU} Tinn-R x w | = QoW Q ,
'
wvt
} o
w |vqw] xt=vQ@ l}
v
Q CU=
|= @ "
Q
2 3 1
|= H= 'O @
r O wU
w |t O=H}=
"O W
TB Q=m u}=
R=
OQ t | y ) m u= D
p t u=
>
Q ?Yv xrLQt
New script xv R File
"
>
x@ =yQoW}=Q} w
|wQ 'Q= i=s v
w xOR =Q
w
wO
wDUO lDlD
C=Q
|=yQoW}=Q} w
wO QO
@ u= D
t
t
} @ w y
R
Q pN=O xm OvDUy |}=yv =yQoW}=Q} w u}= R= Qw_vt %|HQ=N
v Q= i=s v
}= } w R=
xDUO u}= u}@
OvDUy
R= "
=HD =yv
|Q
=
=o}=Q =yv
R= |=xQ B w u
R=
= QoW}=Q} w
| y
|a@ "OvwW
R |U w x = Q
5
wtv
=@ |}=vW
wN@OwN x=ov 'OR =OY u pN=O =Q
O
wtv =QH=
"O
O
R
xDWwv
=Q x W
R
= O
CU=
|Q
w |t
| y ) m u= D
wtv |]
=Q
w |t s}UkD
w O W
download RWinEdt =Q
CU= u=o}=Q =Pr
"
w
= x@ |=
@ } w
R
O}vm =QH= Q=@m}
"
library ("RWinEdt") w |t O=H}= QDw}Bt=m
"O W
RGui O =
desktop
|wQ
}= } w R= xO
v =Q
OW=@|t
}= } w
RWinEdt QoW Q =iD Q ?Y WinEdt R Q O = OD xDU = package O = xr Q u
'O m
s v
Tinn-R QoW Q {
=Ut CtUk wO@ QDw}Bt=m xLiY
Q} R pL=Qt O}=@
=HD Q=Ri=sQv u}= xm OwW|t u=Wv Q]=N xD@r=
?Yv =Q u TBU w xOwtv
|w
Q= i=s v } @
R
Q
= xDU@
hQ
wDU=B
O}|t V}B =]N
>
O}vm xHwD Q} R p=Ft x@
wtv pQDvm
"
"O
=Wa= s=kQ=
=Q |Q
O=
OaD
w |t
digits
=
OaD
=iDU=
options ` =
u= D
Q
wDUO =@
print(1/1:5, digits=2) 1] 1.00 0.50 0.33 0.25 0.20
>
= u}=
Q m
Q O =@ wDUO Qy
|= @ " W v Q
QO
=yv s}_vD
Q
=} Qo}O xm Owtv u}at |rm Qw]x@
|= @ |R v
=Wa=
=Q Q
w |t
"O W
options(digits = 3) print(1/1:5) 1] 1.000 0.500 0.333 0.250 0.200
sQ kQ= O= xO
w |t xD@r=
u= D
@ D R=
> >
=
A J
|W l}
R=
V}@ xm O}W=@ p}=t xJv=vJ
w
Ovm|t
=
A J =Q "
9. Not Available
10. not a number
|W l} \ki
print() ` =
O}vm xHwD Q} R p=Ft x@
@ D
wtv
"O
xm O}W=@ xDW=O xHwD ,=vt
=iDU=
xO
cat() ` =
@ D R=
O}=@
Q
OO o
R |U w x = Q
7
=
=@ |}=vW
} v t v @ u @R
x { 1:10 cat('x=', x, '\n') x= 1 2 3 4 5 6 7 8 9 10 >
pYi
1
=
O
A J = H
Q]U
O
wO QO O= a= w
x=
CtUk xm O}y=wN@ Qo =
wNv sy x@ >
=
"OQ
xm CU= u}=
| H
O}vm pta Q} R
"
' n' CtU
Q \
|= @
w
k
x@ O}=@ OvwW
CQ Y
x { 1:10 cat('x=', '\n', x, '\n') x= 1 2 3 4 5 6 7 8 9 10
>
R u=@ R
QO xO=t |=yxO=O
4 3 1
R = trees Nile LakeHuron iris cars
Ovv=t "OwW|t xO=iDU= u R= R}v Q=DWwv u}= QO xm CU= xOW xO=O Q=Qk =yp=Ft QO xO=iDU= |=Q@ xO=t xO=O |O=OaD
R Q data()
Ci=}
"
>
QO
wDUO
}R Q
R= xO
=iDU= =@ =Q =yu pt=m CUQyi u=wD|t xD@r=
O w Q
Qty
" v= N= i =Q u x=
w |t Q} R QwDUO =@ 'OW
=
wtv x_Lqt Q} R QwDUO \UwD
"O
data(package="gstat") x_ q Q wD = meuse.alt x
'
xO
| yxO=O u= D
library(gstat)
>
::: w
=Q
gstat xDU
@ QO GQ
'
Ovt
'
package l
=iDU=
u @ R QO
=
CUQyi
| yxO=O
'
} R=
Qo = ,=vt
w |t uwvm =
u= D
>
L
t
} R C=Q
UO @ =Q
w Q
=
O CUQyi |=yxO=O |t=U= u=}t R=
@ \ @ t | yxO=O 'x W
w |t p=Ft
u= D
wva x@
u=
wtv
"O
data(meuse.alt) meuse.alt
> >
p}=i R= =yxO=O uOv=wN wtv
"O
xO
=iDU=
w |t Q=m u}=
VwQ wO R= u= D
Q O w |t p}=i
|= @ " v= N
text
|wQ R= =Q
|vDt
5 3 1
=
| yxO=O
read.table uOv=wN QwDUO = x@ |=xWwB
s v
cw
qFt w OW=@
}=QO QO ,
QO w
data.txt |r =
= Qo = "CU=
} i s v
Ovm|t pta Q} R
"
>
w
CQ Y
mydata { read.table("c:/test/data.txt") Q windows p = sDU} x | w C O XNW /
=iDU=
@ D xO
t a
wvm =
p t u
1 5 3 1
w
wDUO u}rw=
OQ t Q
x@ uOv=wN QwDUO x=ov 'OW=@ xOW xQ}NP
Q
=iDU=
"O m xO
U QO
m
nn wO R=
DQ Y QO '
O}=@ O}vm
xO
U= x W
=iDU=
n O
t
=tv
R=
=@ p}=i
TQO
O}y=wN@ xJ=vJ
=}
w
Q |t
"OO o
test
Q}Ut xm O}W=@ xDW=O xHwD =iDU=
xO
mydata { read.table("c: test data.txt")
CWwv
w |t R}v Q} R
u= D
w
CQ Y
x@
w
w xD@r=
=
|DL
=Q j i OQ t
rep() ` =
@ D R=
Q} R
=
=F x@
xO U p t
R |U w x = Q
11
=
=@ |}=vW
} v t v @ u @R
rep(' ', 3) 1] " " " " " >
pYi
1
"
=yxO=O R= |iO=YD |=yxr=@vO O=H}=
R = Q| Q rfunc(n, p1, p2, ) pt=W
u @ R "OO o
t
:::
O}rwD CU= Q=Qk xm CU=
= u}=
m P xQ @
w
CQ Y
O
|O= a= O=
QYDNt KQW u}=Q@=v@ "CU= O}rwD p@=k
QO |
=
= ` w \UwD xr=@vO `wv u}=
|Q t | y } R D
x@ `@=wD u}= |twta pmW "CU= p=tDL= |r=oJ w sQH `@=wD R=
OaD
n=
CU= xOW PN= |iO=YD |=vat x@
yu QO "
O}vm xHwD Q} R p=Ft x@ "OyO|t u=Wv
"
=Q
`@=D
2 7 3 1
random r = Q =k p1, p2, xS=w R=
= QDt=Q B
| y
x_Lqt p@=k O=OaD
|=
}O
Q
xm CU=
h L
Q
t
w
hw L "O W
rnorm(1) 1] 1.358007 >
CU= xOW O}rwD l} Q=}at
"
QLv=
h=
w
QiY u}ov=}t
O =D
= Q |iO=YD OOa l} =Hv}=
OQ= v U= p t v
=yxO=O
wtv
"O
Oyov Q} R
|Q=
=
w
x@
| yCQ Y
=Q
41
Q=DN=U
=yxO=O
w |t
u= D
(vector)
R
=
u @ R QO
Q
Q=O @
(matrix) T Q =
} D t
(array) x (data frame)
Q=O? JQ J | yxO=O
=
=
Q
=
v tR | U | yxO=O
(list) C
U
w |t xDN=OQB =yu
R=
l} Qy
OvDUy u=Um} `wv =@ =kt x@ "CN=U
p
xO=O
Q
=Q Q=O @
OvJ pt=W xm CU= |D}OwHwt
c() ` =
=
Q OvDUy =yQ=OQ@
Q=O @ "
R
'
w |t OW x_Lqt R}v ,q@k xm Qw]v=ty "OvW=@|t
@ D @ u= D
=
u @ R QO
::: w
Qyi
RHt KQW x@ uwvm =
|=
=yQ=OQ@ '
(time series) | =
"O W
}=Q
w
QO
1 4 1
=yxO=O Q=DN=U u} QDxO=U
|k]vt ,=t=tD =}
O = =tD
w O a ,t
O}vm xHwD Q} R
"
x - c(10,5,3,6) x 1] 10 5 3 6 >
=}
w
1390 '
|vWwOv|wUwt
12
y { c(x, 0.55, x, x) y 1] 10.00 5.00 3.00 6.00 0.55 10.00 5.00 3.00 6.00 10.00 5.00 3.00 13] 6.00 >
=yQ=OQ@ |wQ |=} Q C=@U=Lt Ovm|t `@ Qt =Q
"
x
Q QYva Qy
Q=O @
xx
=F
Q
1 1 4 1
w |t s=Hv= VQYva Qy |wQ ,qwtat |OOa |=yQ=OQ@ |wQ C=@U=Lt
p t |= @ "O W
x 1] 10 5 3 6 z {x x z 1] 100 25 9 36 >
>
wtv p=ta=
"O
x
Q
s}DQ=or `@=D ,qFt
Q=O @ |wQ =Q
"O=O
QF=
Q l} QY=va
Q=O @
|wQ =Q
`@=wD
w |t
u= D
log(x) 1] 2.302585 1.609438 1.098612 1.791759 >
=F
w
p t "O W
QD|vqw]
Q
O x@ =D
Q=O @ xR= v=
Q |t Q=QmD QOkv QDx=Dwm
OO o
Q OvW=@v u=Um} pw]
Q=O @ '
O Q}o Q_v
" }
sqrt(x) + 2 1] 5.162278 4.236068 3.732051 4.449490 w | `t 2 O = Q QYv Q TB Q x
Q
|=Q=O Q=O @ wO
O l}
QO =Q O a
xm |Dr=L Q
QO
=
w Q=O @ xO U
>
"O W
t
H
O a
@ Q=O @
a
y
U w OO o
Q
w
O x@ =D CU= xOW Q=QmD Q=@ Q=yJ
Q=O @ p ] xR= v= "
OvW=@
Q Ovwrta
Q=O @
2
O =Hv}=
O a
QO
Qy xm xm O}vm xHwD |r=Ft x@ uwvm =
wO
x { c(1,2,3,4) y { c(1,2,3,4,5,6) z {x y Warning message: In x y : longer object length is not a multiple of shorter object length z 1] 1 4 9 16 5 12 >
Q=OQ@ Q} R O=H}=
wtv O=H}=
Q Q
"O
=F
O}vm XNWt
p t "
w
=Q Q=O @ } R
l}
=NDv= O}=@ xm
=Q O W ?
w |t
u= D
Q =v
w
CQ Y wO
=tW
=iDU= =@
| Y a xQ
x { c(3,11,8,15,12) x c(2,4)] 1] 11 15 >
wtv
"O
>
x { c(3,11,8,15,12)
"
O}vm xHwD
w |t s=Hv=
'O W
x { c(1,3,6,10,15) x 1] 1] 1 x 5] 1] 15 length(x) 1] 5 dim(x) NULL nrow(x) NULL ncol(x) NULL O= Q | wD Q l xx >
u |wQ C
=}rta
wva x@ xm
u=
w x@ "CU=
|OQ= t
Qit Q} R
Zw
w x
CQ Y @
x
Q
Q=O @
>
>
>
>
>
} @ 'OO o
v
U Q=O @
}
m
O}y=wN@ Qo = "CU}v O=a@=
|=Q=O
T} QD=t
O}vm xHwD Q} R
"
x { as.matrix(x) dim(x) 1] 5 1 =W NA C q = = R >
qN Q@
h
= O x@
| y ) m
"O
Q O}vm|t x_Lqt xm Qw]u=ty
Q=O @ '
wtv h} QaD T} QD=t l}
w x
CQ Y @ =Q u
u
v
t
xU =Hv}=
QO "O
a @ yu
=
w
u @ R QO CQ Y
wtv xaH=Qt u=@ R
u}= QO "OvW=@ xOW Owkit |}=yxO=O =} xO=O xm CU= umtt =yxO=O |QU QO
=tvy=Q x@ O}=@ xm 'CU=
|
NA
=iDt =y
Cw
w
OQ t QO
R`w
@= D
pta
wLv "OvwW|t
|x
Q |t Qm P p=Ft
"OO o
"
Ovm|t pkDvt
Q
| U
QN x@
=Q
NA
=
| yxO=O
xO=O
wva x@ `@=D
u=
order() ` =
@ D
1
x { c(1, 20, 2, NA, 22) order(x) 1] 1 3 2 5 4 x order(x)] 1] 1 2 20 22 NA >
>
Ovm|t
"
P
w x w
h L O N @O N =Q
NA
=
| yxO=O
sort() ` =
@ D
2
x - c(1, 20, 2, NA, 22) sort(x) 1] 1 2 20 22 >
na.rm=T |D x { c(1, 20, 2, NA, 22) mean(x) 1] NA =Hv=QU =Q Q=m
"O=O s
> >
,1] ,2] ,3] ,4] 1,] 1 4 7 10 2,] 2 5 8 11 3,] 3 6 9 12 ,,2 1,] 2,] 3,]
,1] ,2] ,3] ,4] 13 16 19 22 14 17 20 23 15 18 21 24
Ctqa OQ@ Q=m
=F
O
|t u=Wv
pw= p t " yO
CU= Q} R
"
w
CQ Y
cbind(m1, m2) ,1] ,2] ,3] ,4] 1,] 1 1 2 2 2,] 1 1 2 2
x@ xH}Dv x=ov
w |t p=ta=
'O W
m1, m2
= T} QD=t
| y
|wQ
cbind ` =
@ D
Qo =
>
wLv "CU}v |U} wvxt=vQ@ x@ '1
MARGIN
Q]U xOvyOu=Wv
=F x@ "CU= `@=D
p t
=}
=}DN=
|Q
wtv p=ta= uwDU
|R v w O
=
T} QD=t
'
= w
| yu t oQ
...
X Q
w
u QO
Q]U =}
xm 'CU=
=ta= CU=
w OO o p
apply() ` = = apply(X, MARGIN, FUN,...) w x |r Q x C |a = FUN c(1,2) Q = wD
w
Q]U
'u
wDU
|wQ =Q
`@ =D l }
w |t
u= D
@ D
CQ Y
Q= k
m
U=
@ D
'
wO
y } w 2 u "
x { rnorm(10, -5, 0.1) y { rnorm(10, 5, 2) X { cbind(x, y) apply(X, 2, mean) y x -5.027833 4.617558 apply(X, 2, sd) x y 0.1023305 1.8215198 =F wv x apply() ` =
>
@
@
m
U
O}vm xHwD Q} R
>
u |wQ p t u=
a
@
CU= uwDU xU pt=W
@ D "
w |t xO}t=v
w O W
trees x
w
R
m OQ=O O Hw |=xO=O '
=
u @ R QO
Q |t p=ta=
"OO o
apply(trees, 2, sum) Girth Height Volume 410.7 2356.0 935.3 >
1390 '
|vWwOv|wUwt
wtv pta Q} R
"O
18
w
CQ Y wO
x@
w |t 'O}vm x@U=Lt
u= D
=Q
Height
wDU l} `tH ,qFt \ki xm O}y=wN@ Qo = uwvm =
u
sum(trees ,2]) 1] 2356 >
=}
sum(trees$Height) 1] 2356 =iD w |t trees =
wDU s=v
O}v=wN|t =Qi Qwm Pt `@=D =@
= OD@=
w
>
xO
U= u= D
v
| yxO=O u
R=
\ki
wtv
=Q xO=O s v =
"O
xO
u}ov=}t '`tH x@U=Lt
::: w
=iDU=
w |t
u= D
attach()
"O=O s
attach(trees) sum(Height) 1] 2356
=Hv=
Q
w
w
Qy
|= @ j i CQ Y wO
R
= x@
s v
w
=
u @ R QO
|a@=D
Q
= u}=
Q
R= Q m
=}rta =yuwDU s=v =@
= =t=
QO x Nq @
wtv
|= @ "O
w |t TBU
=Q j i C
u= D
w
> >
wtv
"O
=iDU=
xO
names() ` =
w |t
@ D R= u= D
trees
=
| yxO=O
xawtHt pN=O
QO
=yQ}eDt |t=U=
names(trees) 1] "Girth" "Height" "Volume"
OaD
w O=
R= `
q]=
Q
|= @
>
`@=D
=
= w
| yu t oQ
x@ p=Ft
wva x@ "OyO u=Wv =tW x@
u=
=Q
`@=D l}
=
= w
| yu t oQ
Ov=wD|t
args() ` = R
=
@ D
u @ R QO
%xHwD
apply()
O}vm xHwD
"
args(apply) function (X, MARGIN, FUN, ...) NULL >
|W l} Q=DN=U xOy=Wt R=
str ` =
: : : w
=
w |t xO}t=v
@ D s v "O W
`@=wD '=yQ}eDt '=yxO=O
R=
str() x
wtv
m O
=iDU= |a@=D
xO
w |t
R= u= D
sa= |W Qy Q=DN=U Ov=wD|t `@=D u}=
args() names() ` w w
@= D
Q |t |W=v Q=DN=U
"OO o
|
Q@
=vat x@
1 2 4 1
R = structure xtr qa
xw
u @ R QO
O}vm xHwD Q} R p=Ft x@ "OyO u=Wv
"
m
=Q
> str(trees) 'data.frame':
31 obs. of
3 variables:
$ Girth : num
8.3 8.6 8.8 10.5 10.7 10.8 11 11 11.1 11.2 ...
$ Height: num
70 65 63 72 81 83 66 75 80 75 ...
$ Volume: num
10.3 10.3 10.2 16.4 18.8 19.7 15.6 18.2 22.6 19.9 ...
O =Wt
x y
=Q
Q}eDt Qy
=
| yxO=O R=
|DtUk
=
w yxO=O O=
OaD '=yxO=O `wv
w |t =yQ}eDt |t=U=
u= D
OaD Q@
w O=
qa =Hv}=
xw
QO
wtv
"O "
O}vm x=ov
Q
'Gw N
`@=D |va}
q() ` =
=D =
@ D Q N U
x@ p=Ft
u=
wva x@ =}
w
R |U w x = Q
19
=
} v t v @ u @R
=@ |}=vW
1
pYi
str(q) function (save = "default", status = 0, runLast = TRUE) >
u C=}rta w
m1, m2 T Q = Q p = x rbind(m1,m2) %*% cbind(m1, m2) ,1] ,2] ,3] ,4] 1,] 2 2 4 4 2,] 2 2 4 4 3,] 4 4 8 8 4,] 4 4 8 8
O}vm xHwD
"
} D t wO ?
Y L
=F
Q
w |t
@ p t |= @ "O W
=iDU= %*% Qorta
xO
T} QD=t
2 2 4 1
T} QD=t
wO ? |= @
R=
Q
Q
>
=}
cbind(m1, m2) %*% rbind(m1, m2) ,1] ,2] 1,] 10 10 2,] 10 10
w
>
l} uDN=U =}
Q]k
w |
= x
| y }QO
Q}}eD =}
QNDU=
w G=
Q
|= @
diag() ` =
Q |t pY=L
@ D "OO o
t() ` =
@ D
"OwQ
\UwD x}=Q l}
|t Q=mx@
=yv=QD
xO
Q]k T} QD=t
|
diag(m1) 1] 1 1 diag(rbind(m1, m2) %*% cbind(m1, m2)) 1] 2 2 8 8 diag(m1) { 10 m1 ,1] ,2] 1,] 10 1 2,] 1 10 diag(3) ,1] ,2] ,3] 1,] 1 0 0 2,] 0 1 0 3,] 0 0 1 v { c(10, 20, 30) diag(v) ,1] ,2] ,3] 1,] 10 0 0 2,] 0 20 0 3,] 0 0 30 >
>
>
>
>
wtv O=H}= u}}=B ErFt T} QD=t =}
"O
> > >
A { matrix(1:9, nc=3) A row(A) col(A)] { 0 A
R
= u}=
?DQt Q}e %OvwW|t u=}@
|vW ,qFt 'O} Q}o@ Q_v
w
@= D R= Q m
x wkt =} |=xDUO
O}vm|t x_Lqt xm Qw]v=ty "CU= ?DQt QwDm =i u}= 'O}vm s}UkD "
=
|= r
w
O
| yxO=O u= D
} w
?DQt
::: w
Q
|= @ "OQ= v O Hw
edit() = x() ` w
"
Qo = =t= "OvDUy ?DQt Q}e QwDm =i xm
p}O@D
Q=O? JQ J | yxO=O
>
?DQt CQwY x@ xm O}vm xHwD Q} R p=Ft x@ q=L "CU=
=Wv
xO=O u
=
K]U xU =}
=Q l N
=
w xU
w l N ` v
levels CtU "
k QO
CU=
soil.degrees { c("weak","average","stronge","weak","stronge") soil.degrees { ordered(soil.degrees,levels=c("weak","average","stronge")) soil.degrees 1] weak average stronge weak stronge Levels: weak average stronge
>
|v=tR |QU |=yC}OwHwt w
O
|t p}mWD
" yO
"OQ=O O Hw
=yu
RHt |v=tR
| U
=Q =
Q
QO
xirw-t
Q |t O=H}=
wO "OO o
l} uwDU Qy xm CU=
ts() ` =
O
@ D
=@ |v=tR
=
CU= |N} Q=D
Q
|W
|U} QD=t =}
R
=
u @ R QO
Q =
Q=O @ ' yxO=O
=Ut pY=wi '=yxO=O M} Q=D
|O a | yxO=O R=
"
=
| y| U
1] 0.259665308 -0.339443370 -0.001599916 -0.017131291 0.098509268 1] TRUE ?}W Q=OQ@ Q
R= Z a R=
u
xirw-t u}rw= xm CU= CUQyi l} u}= "CU= xOW xO=O C@Uv
=} xm OyO|t u=Wv OL=w pw] =@ swU
Q CU=yxOv=t}k=@
Q=O @ "
z x lst(x,y) | @
Q
Okt p=Ft u}= QO
Hw N Q=
Q
xirw-t "CU=
R= |Q=O @ swO
f
"
O}vm xHwD Q} R p=Ft x@ "CW=O wD
QO
wD
= xkrL
| y
w |t
u= D
z - matrix(2, 4) for(i in 1:2) + for(j in 1:4) z i,j] - i+j z ,1] ,2] ,3] ,4] 1,] 2 3 4 5 2,] 3 4 5 6 >
>
`@=wD "
CU= Q} R KQW x@ `@=D l} uDWwv |twta QwDUO "OyO|t s=Hv=
functionName { function(arg1, arg2, do this
)
Ovm|t x@U=Lt
=Q
P
h L
=yxO=O Q=}at
5
CU= xHwD QwNQO Q} R
O
O a
a, b C w QLv=
w
a, b |D w
= Q}eDt
=Lt =@
h} QaD 'OW s=tD x@U=Lt |Dkw
O= a=
=@
w xt=vQ@
k t | y
sqrt(a^2 + b^2) x@
k t
h=
O
w
OQ= t j i
U
u}ov=}t xm O} Q}o@ Q_v
QO =Q
Q} R `@=D
QO
%p=Ft
mystats { function(x)
R
=
u @ R QO
list() ` =
@ D R= xO
=iDU= =@ `@=D u}ty
mystats { function (x)
Q@ Q=m xOW h} QaD Qorta l} CN=U Qmrta x@ p=Ft
O
Q
`w W R=
p@k
w |t
"O W
=iDU=
xO
Ctqa
&
= u}=
Q CN=U
R= Q m
|= @ "
=Q
Q_v
4 3 5 1
R = setdi() union() ` w
w Qorta
OQ t
O}vm xHwD
"
w |t
u= D w
u @ R QO @= D
x { c(1,2,5) y { c(5,1,8,9) union(x,y) 1] 1 2 5 8 9 setdi(x,y) 1] 2 setdi(y,x) 1] 8 9 >
>
>
"
Ovm|t x@U=Lt
sdf%" { function(a,b) + sdfxy { setdi(x,y) + sdfyx { setdi(y,x) + union(sdfxy,sdfyx) + x %sdf% y 1] 2 8 9
>
"%
>
wDUO =@ |}=vW
C=Q
`@=wD
Q
|= @
12
s}UQD QO |v=w=Qi OQ@ Q=m xm |a@=D "OOQo|t x_Lqt |Q=Owtv |q=@ K]U `@=wD R= |O=OaD CtUk u}= QO "O
>
u @ R QO
wtv Ovv=wD|t xm 1 q=@ K]U `@=wD
|Q=Owtv
plot() ` =
w |t
u= D
=Q | Y a
OaD
R= |O=
wtv } w
OO
Q=O
=
| yQ=O
demo(persp) =
=Q | } H Q=O
wtv x@
"
" W
UQ
x { rnorm(50) y { rnorm(50) plot(x,y)
Q=O
wtv l}
w |t
u= D
<
expr from, to |k]v add
Q@ xm |DQ=@a
curve(dnorm(x), from=-3, to=3)
3 = -3 D
O =D
= Q `@=D
R= =Q OQ= v U= p t v
Q=O
wtv
%p=Ft
wtv sUQ
pYi
=Q u 82
pmW
25 15
20
type=’b’
0
5
10
y 0
5
10
y
15
20
without type
−4
−2
0
2
4
−4
−2
x
0
2
4
2
4
x
type='b' =
wtv V}=tv
%32
pmW
25
25
@ Q=O
15
20
type=’h’
0
5
10
y 0
5
10
y
15
20
type=’c’
−4
−2
0
2
4
−4
−2
x
0 x
type='h' type='c' = w
wtv V}=tv
@ Q=O
%42
pmW
O
|t u=Wv
" yO
Q} R
2
Q=O
25
35
= O x@
| y ) m
Q |t xi==
"OO o
Q wDU}y x@ CU= xOW x}yD
u s= o
curve() ` =
@ D
\UwD xm p=tQv p=tDL= `@=D =Hv}=
QO
%p=Ft
O}vm xHwD
"
> > > > >
set.seed(1) x { rnorm(10000) x x -3.5 | x 3.5] { NA hist(x, freq=F, breaks=30) curve(dnorm(x), -3.5, 3.5, add=T)
>
layout(matrix(1:4, 2, 2)) layout.show(4)
1
3
2
4
=F
%2 p t
> >
layout(matrix(1:6, 3, 2)) layout.show(6)
1
4
2
5
3
6
=F
%3 p t
wtv sUQ
39
Q=O
2
pYi
0.0
0.1
0.2
Density
0.3
0.4
Histogram of x
−3
−2
−1
0
1
2
3
x
u
> >
x@
w Q
Q wDU}y
\ @ t s= o
O =D
= Q `@=D V}=tv
w OQ= v U= p t v
%92
layout(matrix(1:6, 2, 3)) layout.show(6)
pmW
1
3
5
2
4
6
=F
%4 p t
> >
1
layout(matrix(c(1:3, 3), 2, 2)) layout.show(3)
3 2
=F
%5 p t
m { matrix(1:4, 2, 2) layout(m, widths=c(1, 3), + heights=c(3, 1)) layout.show(4) >
1
3
2
4
>
u=tRsy
QHvB u}rw=
x
w
R
=
w |t xO=iDU=
u @ R "O W
windows() ` =
= u}= |=Q@ "CW=O sy =@ ,=t=wD
@ D R= Q m
wWo xQHvB l} O}=@ |Oa@ Q=Owtv |=Q@ =yDvt "Ovm|t R=@
O W xO
|m}i=Qo xQHvB OvJ O=H}=
hist() = plot() pF } w
"
O}vm xHwD Q} R p=Ft x@
t
5 1 2
w |t =Q |m}i=Qo xQHvB OvJ
u= D
|D=QwDUO =@ OwNx@OwN =Q |m}i=Qo |t CUO
"OwQ
R=
|r@k
wtv xvQow
Q=O
1390 '
|vWwOv|wUwt
40
Normal Q−Q Plot
2 1 0
0
−2
−1
Sample Quantiles
15 10 5
Frequency
20
Histogram of x
−3
−2
−1
0
1
2
−2
−1
0
1
2
Theoretical Quantiles
0 −2
−5
−1
0
y
1
5
2
x
−2
−1
0
1
2
x
=
|Q t Q=O
wtv OvJ V}=tv
%102
pmW
Outer margin 4
Outer margin 2
Outer margin 3
Plot region
Figure region
Outer margin 1
Q=O
> > > > >
wtv
= VN@ V}=tv
| y
%112
pmW
x { rnorm(50) y { rnorm(50) hist(x) windows() plot(x,y) <
Q=O
wtv x@
=Q
|i== xv=Wv
w \
=kv
points() ` =
@ D
points(rnorm(4), rnorm(4), pch=3, col="blue") points(rnorm(4), rnorm(4), pch=4, cex=3, lwd=2) points(rnorm(4), rnorm(4), pch="K", col="green") O
|t u=Wv
" yO
Q
=Q O=O Q= k xO
=iDU=
w
w |t xm |}=yxv=Wv
OQ t u= D
R=
|DUQyi Q} R xt=vQ@
plot(0:10, 0:10, type="n", xlab="", ylab="") k { -1 for (i in c(2,5,8)) + for (j in 0:9) + k - k+1 + points(i, j, pch=k, cex=2) + > >
f
f
=yQwLt pQDvm Q |t O=H}= =yZQiV}B
"OO o
=iDU= =@ OwNx@OwN =yQwLt |=y?UJQ@ w =yQwLt 'O}vm|t O=H}=
R= xO
=F x@ "OvwW|t hPL =y QwLt
p t
axes = F
R= xO
wtv =tW |Dkw
=Q |Q=O
=iDU= =@ ,qFt "Owtv pQDvm |m}i=Qo |=yQDt=Q=B =@ u=wD|t =Q C=t}_vD u}= "
> >
O}vm xHwD Q} R
x { rnorm(100) y { rnorm(100) <
>
Q
OQ=w
|DUO Qw]x@ =yQwLt
axis(side=1) axis(side=2) = = Q 3
x Nq @ w q @ |= @ "
O
O a '
AJ CtU
O}vm xHwD Q} R |=yOm x@ "Owtv sUQ =Q
{ rnorm(100) y { rnorm(100) plot(x,y, axes=F) axis(side=1, pos=0) axis(side=2, pos=0)
Q
|= @
y x w
2
O
u}}=B
O a '
Q
|= @
1
O
= wLt pLt u=wD|t
| yQ
O
O a " yO
pos
|t u=Wv
= w
wLt sUQ pLt
=Q Q
side
=iDU= =@ "CU=Q CtU |=Q@
u t oQ R= xO
= w
u t oQ
4
O
O a
> < > > > >
>
> > Q
t wO
y
y=
@
o = "O
v xO
U=
}
R= u= D
t
"
} w
m xO
}Q
U=
wLt sUQ
r | yQ
w
R= O W
Q
|= @
|tD} Q=or
wtv sUQ
Q=O
−1.2
−0.4
y
0.4
1.2
51
day 1
day 3
day 5
day 7
day 9
day 11
day 13
day 15
day 17
day 19
x
lJwm
O =@ QwLt
xR= v=
|wQ
=y?UJQ@ pLt V}=tv
%252
pmW
2
pYi
swU pYi
=tD
p
p@=k O=OaD =yu Q@
qa "CU=
xw
O
" W
=
=
=
L= w Q t
O
=
p}rLD
|Q t |R Up t w yxO=O
Oy=wN EL@ =yu
R= |Ow
OLt
OaD
O=
=
=@ =Lt
Q `@=D
'|Q t C U
|wQ
=Hv}=
|= @
w
QO "OQ=O O Hw
=y
=
|O } R O=
package
|Q=t
O = |t
" W @
Q
Q=
u=w= i O @ m |=Q=O
Q} R CUQyi "CU= O=} R Q=}U@
" yO
t =Q
" yO
|t
O
|t
52
=Q
=Q
Y a
R
x_Lqt
|=
13
`@=wD
1 1 3
u @ R QO
`@=wD CUQyi
=
xQ
=v
wtHt
Y a `
D
H
Y a ?
t =Q
" yO
" yO
`@=D
=
u @R
sum(x) | x Q =v |atH `t %cumsum(x) O | x Q =v Q p = %prod(x) O | x Q =v QF O %max(x) O | x Q =v p O %min(x) x QYv u QD R T O %which.max(x) O
" yO
O
QO
x}=B `@=wD
O=} R |Q@ Q=m =@
R
OaD pt=W
t =Q
Y a
" yO
t =Q
Y a
a
oQ @
} v=
}
Y L
m= L
k= L
%
=tDL=
53
p
=
w Q t
3
pYi
which.min(x) C c(min(x), max(x)) =a ` = u %range(x) O | x Q =v Oa %length(x) O | x Q =v u}o =} %mean(x) O | x Q =v x =} %median(x) O | x Q =v T = %var(x) O | x Q =v =}a QL %sd(x) O = T Q = l x Q Ov | x@ =L |oDU@t T Q = %cor(x) O | C O y x u} |] |oDU@t ? Q %cor(x,y) C | x Q | wm w %chisq.test(x) C h Q}t Q wtr x Q | wm w %ks.test(x) C x wt = l Q C wD t w %t.test(x) C y x T= QQ w %var.test(x,y) O
" yO
"
|t
x QYv
=Q
u} QDmJwm T}Ov=
a
U=
pO
" yO
t =Q
} D t
" yO
t
"
"
U=
}
o= '
Y a
" yO
t =Q
Y a
U @
U=
"
U
v wO
U=
v } Q=w
t h=
y
y
}
v=
} D t
}
v u tR
@ VR= @
}
} |= @
w
v t
t =Q
N
}
D
v t
Y a Q
@ VR= @
}=
Y a
t =Q
m VwQ
v
t =Q
@ =Q
N VwQ
U=(hw o
"
t
w
U= wO
v
m
@ D
Y a O=
t =Q
" yO
" W @
t
" yO
" yO
%
v u tR
vO
U=
u tR
v } Q=w | @= @ u tR
|iO=YD O=Oa= w |r=tDL= |=y`} RwD OvDUy Q} R
"
w
CQ Y
x@ xm 'CU=
=iDt pmW Q=yJ
Cw
O
|t u=Wv
" yO
O
|t u=Wv
" yO
O
|t u=Wv
" yO
"
Q@ Q=m
w
CU=
Q V}B
w
Z i
CQ Y
0
x x]k
Ovm|t
x x]k
=D
v
< p
Q
| U
Q
= H=
=@ xm
Qy
Q |t O=H}= |iO=YD
'OO o
=ov 'O}vm
QO x
O
OO
=iDU= |iO=YD O=Oa= `@=D
xO
Q
l} O}vm|t =QH=
O= a= R= | } H | U
Q
p@k
|= H= R=
set.seed()
CU= K}LY OOa l} Q}N= `@=D u=twoQ
" "
O}vm xHwD Q} R p=Ft x@ `} RwD l}
w O
"O @ x W
X (x) = Pr(X
F
|iO=YD
=Q
wDUO
Q
R=
O
O= a=
Q_v
w `@=D xm Q=@ Qy
OQ t
Qo = uwvm = "CU=
O}rwD ,q@k xm Ci=} O}y=wN
) |atH
x
D p
=tDL=
=iDt u}W}B
Cw
Q
=ty
CUO@
|= @
=Q | U u
uOQw
Q
1390 '
|vWwOv|wUwt
54
u
`@=wD
=
= ` w
O
w |Q t | y } R D %13 pw H
package beta beta shape1, shape2 -, stat binomial binom size, prob -, stat Cauchy chauchy location, scale 0, 1 stat 2 chisq df, ncp -, 0 stat Dirichlet dirichlet alpha MCMCpack exponential exp rate 1 stat F f df1, df2, ncp -, -, stat gamma gamma shape, rate, scale -, 1, 1/rate stat geometric geom prob stat Generalized Extreme Value gev xi,mu,sigma -, -, evir Generalized Pareto gpd xi,mu,beta -, -, evir hypergeometric hyper m, n, k -, -, stat Inverse Gamma invgamma shape,rate -, MCMCpack Inverse Wishart iwish v, S -, MCMCpack logistic logis location, scale 0, 1 stat lognormal lnorm meanlog, sdlog 0, 1 stat Multinomial multinom size, prob -, stat lognormal lnorm meanlog, sdlog 0, 1 stat Multivariate Normal mvnorm mean,sigma -, mvtnorm Multivariate-t mvt sigma,df -, mvtnorm negative binomial nbinom size, prob, mu -, -, stat nomal norm mean, sd 0,1 stat Poisson pois lambda stat 'Student' (t) t df, ncp -, 0 stat Weibull weibull shape, scale -, 1 stat uniform unif min, max 0,1 stat Wilcoxon wilcoxon m, n -, stat Wishart wish v, S -, MCMCpack C R = w |r xDU = x = w_v ( `} RwD
O)m
=yQDt=Q=B
Q V}B
Z i
"
U=
u @R O N
Y=
y
} w
} B Q
t
=tDL=
55
p
pnorm(1.96) 1] 0.9750021
=
w Q t
3
pYi
>
"OQw
CUO@ R}v
=Q
1
X (x) = Pr(X
)
; F
> x
pnorm(1.96, lower.tail=F) 1] 0.02499790
p
=tDL= |i== u=mt= l} =@
w |t uwvm =
u= D
>
w
u tR
|v=QL@ Q}O=kt |=Q@ ,qFt "OQ}o|t Q=Qk xO=iDU=
w
=
w
OQ t |Q t u tR QO
P-value =
CU= Q} R
w
"
qnorm(0.025) 1] -1.959964 qnorm(0.975) 1] 1.959964
|v=QL@ Q}O=kt uOQw CUO@ |=Q@
} w
CQ Y
x@
&
5
Q
= Q `} RwD xiQ]
|= @ p t v
wO
>
>
= CU= Q@=Q@
% @
1-pchisq(3.84, 1) 1] 0.05004352
df=1 = 2 = 3 84 @
:
w
P-value
Q
u tR |= @
Okt
Q=
>
O}vm
"
1-pf(3.6,4,43) 1] 0.01284459 %5 w Q|
=UL
?
f(4,43) ` =
@ D QO =Q
3.6
O
O a
P-value
Q=
Okt "O}vm xHwD Qo}O p=Ft l} x@
>
u J OO o
t OQ
w
|vat K]U
uO @ Q=O
w
Q
"O W ? wO QO
Q =t= "CU=
|= @
O}=@
P-value
u R=
QDoQR@ =Q} R OwW|tv
w xiQ]
O @
w
wO u tR
%
OQ
Qo = xm OwWv
1
w
|vat K]U
uO @ Q=O
w Q CU=
V t= i "
u R=
Q
|= @
QDmJwm
1-pt(2.8,21) 1] 0.005364828 2 (1-pt(2.8,21)) 1] 0.01072966 >
>
O}vm x@U=Lt
"
=
=Q u | yl
OvJ O}v=wD|t O}W=@ xDW=O
w
=Q uO @ Q=O
|vat K]U Qo = uwvm =
alpha - c(0.1, 0.05, 0.01, 0.001) qnorm(1-alpha/2) 1] 1.644854 1.959964 2.575829 3.290527 >
s=QowDU}y
CU= Q} R KQW x@
%
u
Qt=Qo xm "CU= |iwQat
Q=O
wtv
Q wDU}y p=tDL=
's= o
hist(x,breaks="Sturges",prob=FALSE) =H}=
O
=Q
|@U=vt=v pmW Ov=wD|t sm |r}N =} O=} R |r}N =yxDUO "
CU= Q} R pmW x@
u
x]@=Q xm Ovm|t
xO
=iDU=
OaD "OyO|t u=Wv
O=
Sturges
log2 ( ) + 1
d
n
e
w Q
p t i R=
R
=Q
=yxDUO =
1 2 1 3
O=
OaD
breaks
Q V}B
u @R Z i
w
=
w Q t QO
= w
u t oQ
Ovm
CQ Y QO "
1390 '
=
T U=
|vWwOv|wUwt
Q@ xm
56
Freedman-Diaconis (FD)
w Q pFt 'Ovm|t u}at =Q xDUO |=vyB xm OQ=O OwHw R}v |Qo}O |=yVwQ
p t i
CU= Q} R pmW x@
"
2 iqr
CU= xOW O=yvW}B
"
Scott \ 35 :
x]@=Q
u
=F
wvax@ "O}vm
=iDU=
xO
w
U D w
CU= Q} R pwtQi
nclass=num. of class Q |t s}_vD
OO o
x w x pmW
|= v o @
=v@t xm
u |
w
= w
CU= Q=}at
O}v=wD|t OW=@ =tW Q=}DN=
u t oQ R=
20 Q_
|
Qo}O pwtQi
w
w |t p=aiQ}e |v=w=Qi
w O W
w |t u=}@ Q} R
%O W
QLv=
h=
q =
s u QO
xm
QDvm O}y=wN@ Qo =
QO , t m p
nclass=20 freq=F wD
Q wDU}y
v OQ t s= o
prob=T =
p=tQv p=tDL=
"
OLt
; 31
} w
w
(
R}v
OQ=O O Hw
"O W
f x
xOw
s n
Ovm|t O=H}= xDUO
=yCL=Ut `wtHt xm
|mQ=J u}@
; 31
" QO
n
" p t u=
iqr
Q
"OQ=O Q= k
Q
|= @
Q
OL=w Q@=Q@ s=QowDU}y
|r=oJ `@=D
w x
UO QO
= Q
CQ Y @ p t v p
2 2 1 3
=tDL= |r=oJ `@=D
(x;)2 ) = 1 ; 22 2 p
e
O}vm xHwD Q} R pmW x@
u
|atHD `@=D
=tDL= |r=oJ `@=D V}=tv
w p
Q
|= @
X { seq(-4,4,0.1) par(mfrow=c(1,2)) plot(X,dnorm(X),type='l',xlab="x", ylab="f(x)", main="PDF's Normal") plot(X,pnorm(X),type='l',xlab="x", ylab="F(x)", main="CDF's Normal")
p=tDL= VwQ
Ovv=t |}=yVwQ
R= "O
wtv
Q
=tDL= `@=D l}
OQw @ =Q p
wtv
"O
Q |}=tvDUQO QFm =OL
OQw @
VwQ
x@
=Q p
=tDL= `@=D
=
xQ W=
= QDt=Q=B xm
| y
CU= Q=Qk xm |}=yxO=O pw= 'CU= |QwQ u=twoQ
wO |=Q=O
Q}o Q=Qk uW}Dwm pN=O
"O
`@=D
Q =@ uwvm =
Z i
w |t O}rwD XNWt
"O W
Q |t
"OO o
Q CU=xDi=}
OQw @ '
>
|vWwOv|wUwt
66
data(trees) t.test(trees$Height, mu = 70) One Sample t-test
data: trees$Height t = 5.2429, df = 30, p-value = 1.173e-05 alternative hypothesis: true mean is not equal to 70 95 percent condence interval: 73.6628 78.3372 sample estimates: mean of x 76 w |t
"O W
xDU=m =yu p}=t
h
QYt
mpg Q}eD
t "
R=
=} xm CU= u}=
Ovm|tv
xO
=iDU=
w
p= U u
u R=
Qo}O
wvm =
Q |t xi==
"OO o
w
|wQO N
w
wQO N
VW w Ovm|t "
OQ
QiY
CNwU x@ |vOwRi= l} O}vm
=iDU=
xO
CU= Q} R
w
u R= wQO N
w x xm 'CU= xOW
Q
%2 p=Ft
Q
w |t
Z i
VW Q=m u}=
CQ Y @
Q u}=Q@=v@
Z i
|= @ #O W
Q}oxR=Ov= ur=o Q@
|
1 2 3 4 5 6 Car mpg w/ additive 24.6 18.9 27.3 25.2 22.0 30.9 mpg w/o additive 23.8 17.7 26.6 25.1 21.6 29.6 > > >
add { c(24.6, 18.9, 27.3, 25.2, 22.0, 30.9) noadd { c(23.8, 17.7, 26.6, 25.1, 21.6, 29.6) t.test(add, noadd, paired=T, alt = "greater")
> >
v xO
U=
w
w |t R}v OvW=@ xOW PN= `} RwD l}
u tR R= u= D
Q
R= |Q=O @ |xO=O wO
Qo =
x1 { rnorm(100) x2 { rnorm(100) ks.test(x1, x2) <
=F l} x@ uwvm =
R= p t
= O x@
| y ) m
w |t
"O W
p= U u
wvm =
=iDU= |N
xO
counts { c(43, 49, 56, 45, 66, 41) probs { rep(1/6, 6) chisq.test(counts, p = probs)
0 1107 x :
w |t x_Lqt
m O W
sQ=yJ pYi
u
lm, pF
t
w} Q
= O
U oQ | yp t
|a@=wD uOv=wN=Qi j} Q] R= =ypOt u}= ,=twta "CU= |Q=t |=ypOt "
CU= Q} R
w
CQ Y
x@
Q
=
Q
Q
=
R glm,
= u}DwQ |=Q=O
VR= @ |= @ |O } R | y
O l} |rm pmW "Ovvm|t pta
VR= @ |Q t p t
=
u @R
respose ~ expression uw}UQoQ |=ypOt
|]N
pwtQi |=yC}OwHwt
O
" yO
y
`} RwD
=@ =
|=Q=O , r e "
= 0+ 1 1+
|va} =]N xrtH "OyO|t u=Wv wtv
"O
x
=Q u
+
Q Q} R
VR= @
w
y ~ x1+x2 68
w
CQ Y
x@
=Q
|]N pOt l}
1 1 4
R
=
u @R
p p+"
x
w}UQoQ ?}=Q
=iDU= Q} R pwtQi
xO
|t
14
lm() ` =
O@t
w > >
|wQ
x { read.table("F:/R_les/data/gen_reg.txt", header=T) m.reg { lm(gene2~gene1, data=x) m.reg
>
xDi=}
U=
Q \N
VR= @
u
wtv sUQ
w O
= |HwQN uDi=}
y
=Q
w_vt
R= Q
Vvm =QB
wtv
Q=O
w
Q
|= @
=F
j i p t QO
w |t uwvm =
u= D
plot(x$gene1, x$gene2) lines(x$gene1, tted(m.reg)) wtv
"O
>
=Q
w Q
\ @ t | y
Description regression coecients residuals tted values analysis summary predict for new data residual sum of squares C m.reg =t obj "
"
x@ uw}UQoQ x@
xO
=iDU= R}v Q} R
wDUO
C=Q
w |t xDi=}
R= u= D
plot(x$gene1, x$gene2)
Q \N sUQ
VR= @
Q
w |t pY=L Q} R pmW Q} R
|= @ "O W
= O
Q
) |= H= | y m
=@
|vWwOv|wUwt
72
0.0 −1.0
−0.5
x$gene2
0.5
1.0
1390 '
−1.0
−0.5
0.0
0.5
x$gene1
xDi=}
>
wtv sUQ
>
Vv+m =QB
wtv l} V}=tv
Q=O
%14
pmW
w |t R}v
u= D
= O =t}k=@ 'xDi=}
=Q yx v
Q \N w |@ QHD \=kv Q@
VR= @
xw
qa xm O}vm|t x_Lqt
=Q
|rmW Q} R
QO u
wvm =
plot(x$gene1, x$gene2) lines(x$gene1, tted(m.reg)) segments(x$gene1, tted(m.reg), x$gene1, x$gene2, lty=2)
0.0 −1.0
−0.5
x$gene2
0.5
1.0
>
w
abline(m.reg)
"O
>
Q \N
VR= @
−1.0
−0.5
0.0
0.5
x$gene1
=yxOv=t}k=@ O =D
=]N
w OQ= v U= |
tQ
'
=kt Q}_v xDi=}
}O
Q
w}UQoQ
w u
O
VR= @ p t R=
wtv l} V}=tv
Q=O
|i==
= q]=
C a
%24
=
pmW
R= |=xQ B uOQw
CUO@
Q
|= @
summary() ` =
@ D
O}vm xHwD Q} R p=Ft x@ "CU= O}it =yQDt=Q=B u}@ |oDU@ty
"
>
summary(m.reg)
w}UQoQ
73
u
=
O
| yp t
pYi
4
Call: lm(formula = x$gene2 ~ x$gene1) Residuals: Min 1Q Median 3Q Max -0.3812 -0.2196 -0.0084 0.1492 0.7595 Coecients: Estimate Std. Error t value Pr( t ) (Intercept) -0.05541 0.07330 -0.756 0.461 x$gene1 0.97070 0.12925 7.511 1.25e-06 *** | Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 >j j
Residual standard error: 0.311 on 16 degrees of freedom Multiple R-squared: 0.779, Adjusted R-squared: 0.7652 F-statistic: 56.41 on 1 and 16 DF, p-value: 1.246e-06 wtv x@U=Lt
"O
w}UQoQ xrO=at ?}=Q
=Q u
coef(m.reg) (Intercept) gene1 -0.05540906 0.97070027 connt(m.reg) 2.5% 97.5% (Intercept) -0.2107882 0.09997012 gene1 0.6967126 1.24468796 C Q Qy w | predict.lm() ` = = u Q
xrY=i
|=
Q
w |t
OQw @ u= D
connt() ` =
@ D
=@
>
>
"
i o x
@ u= D
t
@ D R= Q m
"O=O
}= |= @ "O
CUO@
wtv OQwQ@ uw}UQoQ xrO=at R= xO=iDU= =@ =Q |O}OH Q}O=kt u=wD|t
=Q |=
xrY=i
Q sy
OQw @
x]kv
w |=
Q
Okt sy
OQw @ Q=
w
CQ Y
u}=
predict.lm(m.reg, newdata=data.frame(gene1=c(0.1,0.2)), int="conf") t lwr upr 1 0.04166097 -0.11587731 0.1991993 2 0.13873100 -0.02557153 0.3030335 C O O O =W = x =t x =y xr = Q x]k = y =t =o wW =iD newdata
QO
>
U @ x W x y
t | y
s
D |=R=
@
v |=
Y i OQw @ w |=
v | y
s
D x
v 'O
v xO
U=
R=
Qo =
O |t
" }
wtv pta R}v Q} R
"O
predict(m.reg, list(gene1=c(0.1,0.2)), int="conf") t lwr upr 1 0.04166097 -0.11587731 0.1991993 2 0.13873100 -0.02557153 0.3030335
>
w
CQ Y
x@
w |t O}OH Q}O=kt
u= D
Q
|= @
1390 '
|vWwOv|wUwt
74
pOt "O
wtv
=
xQ W=
Q} R
w x@
OQ= t
w |t p=Ft
u= D
Q
Q}o|t Q=Qk
|= @ "O
xO
=iDU=
w
X}NWD
X}NWD QDW}@ p}rLD
OQ t '
Q O
1 2 1 4
|= @ x t
CUO@ pOt
OvDUy p=tQv =yxOv=t}k=@ =}
#
OvDUy |]N uw}UQoQ
= Q}eDt
#
| y
w
MU=B u}@ x]@=Q =}
w
Q Q}O=kt =}
#OQ=O O Hw C B
"
> >
Ovm|t pQDvm
=yxOv=t}k=@ p=tQv `} RwD
=Q
k-s
w
u tR
res { resid(m.reg) ks.test(res, "pnorm", mean=mean(res), sd=sd(res))
>
>