DAA03

Similar documents
DAA04

DAA02

DAA12

DAA09

1 R Windows R 1.1 R The R project web R web Download [CRAN] CRAN Mirrors Japan Download and Install R [Windows 9

講義のーと : データ解析のための統計モデリング. 第2回

「統 計 数 学 3」

plot type type= n text plot type= n text(x,y) iris 5 iris iris.label >iris.label<-rep(c(,, ),rep(50,3)) 2 13 >plot(iris[,1],iris

DAA01

講義のーと : データ解析のための統計モデリング. 第5回

RとExcelを用いた分布推定の実践例


スライド 1

k2 ( :35 ) ( k2) (GLM) web web 1 :

<4D F736F F F696E74202D BD95CF97CA89F090CD F6489F18B4195AA90CD816A>

バイオインフォマティクス特論12

再下版島_ (特集1).indd

INTERVIEW

Interview 2 3

.{...iNo.25.j

ZNR ( ) 8/20 µs 8/20 µs (A) (V) ACrms (V) C (V) max.(v) Ip (A) /0 µs 2 ms ERZV ERZV

講義のーと : データ解析のための統計モデリング. 第3回

掲示用ヒート表 第34回 藤沢市長杯 2017

5 LATEX 2ε 2010

PackageSoft/R-033U.tex (2018/March) R:

鹿大広報148号

鹿大広報151


窶廰ナ・ア窶。X窶樞€昶€愴・.3

0-Ł\04†E01.pdf

宿題の解答



2 Part A B C A > B > C (0) 90, 69, 61, 68, 6, 77, 75, 20, 41, 34 (1) 8, 56, 16, 50, 43, 66, 44, 77, 55, 48 (2) 92, 74, 56, 81, 84, 86, 1, 27,

Microsoft PowerPoint - 統計科学研究所_R_重回帰分析_変数選択_2.ppt


kubostat2017c p (c) Poisson regression, a generalized linear model (GLM) : :

★結果★ 藤沢市長杯 掲示用ヒート表


(lm) lm AIC 2 / 1

u u u 1 1

特別支援1~8ページ.PDF


2 3 2

300 10


untitled


14 12 ( ) 2004

第1 予算編成の基本的な考え方

0

untitled


2

0.表紙


,

-2-

総務委員会会議録



(1) (2) (3) (4) (5) (6) (7) (8)

PowerPoint Presentation

kubostat2017e p.1 I 2017 (e) GLM logistic regression : : :02 1 N y count data or

kubostat2015e p.2 how to specify Poisson regression model, a GLM GLM how to specify model, a GLM GLM logistic probability distribution Poisson distrib

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó



Microsoft PowerPoint - R-intro-02.ppt

一般化線形 (混合) モデル (2) - ロジスティック回帰と GLMM

第32回新春波乗り大会2018

( )/2 hara/lectures/lectures-j.html 2, {H} {T } S = {H, T } {(H, H), (H, T )} {(H, T ), (T, T )} {(H, H), (T, T )} {1

統計学のポイント整理

k3 ( :07 ) 2 (A) k = 1 (B) k = 7 y x x 1 (k2)?? x y (A) GLM (k

3 M=8.4 M=3 M=.8 M=4.7 M=5.6 M=3 M=5. M=4.6 M=7 M=3 M= (interaction) 4 - A - B (main effect) - A B (interaction)

バイオインフォマティクス特論4

31 gh gw

yamadaiR(cEFA).pdf

統計研修R分散分析(追加).indd

R pdf

1 2 S-PLUS python MeCab csv S-PLUS csv S- PLUS S-PLUS csv python word1,word2,word3 2 python MeCab MeCab ipadic html 2010/3/26

スライド 1

第122号.indd


R-introduction.R

1.2 R R Windows, Macintosh, Linux(Unix) Windows Mac R Linux redhat, debian, vinelinux ( ) RjpWiki ( RjpWiki Wiki

A4“û”q

HA TO MARK

Q Q Q Q 2

最小2乗法

untitled

¸×ÌÞÆ�°½-No.94-’ÓŠ¹

スライド 1

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó

5 Armitage x 1,, x n y i = 10x i + 3 y i = log x i {x i } {y i } 1.2 n i i x ij i j y ij, z ij i j 2 1 y = a x + b ( cm) x ij (i j )

メディシノバ・インク

_FH28_J.qxd

homes10_P _shimizu_intN_sai.indd

Isogai, T., Building a dynamic correlation network for fat-tailed financial asset returns, Applied Network Science (7):-24, 206,

.....Z...^.[ \..

Transcription:

par(mfrow=c(1,2)) # figure Dist. of Height for Female Participants Dist. of Height for Male Participants Density 0.00 0.02 0.04 0.06 0.08 Density 0.00 0.02 0.04 0.06 0.08 140 150 160 170 180 190 Height 140 150 160 170 180 190 Height

HISTOGRAM hist(dat[dat$gender=='f',]$h, main="dist. of Height for Female Participants", xlab="height", xlim=c(140,190), probability=t) # dat[dat$gender=='f',]$h # dat gender F dens.f = density(dat[dat$gender=='f',]$h) lines(dens.f, col='blue',lwd=2) hist(dat[dat$gender== M,]$h, main= Dist. of Height for Male Participants, xlab= Height, xlim=c(140,190), probability=t,ylim=c(0,0.08)) dens.m = density(dat[dat$gender=='m',]$h) lines(dens.m, col='green', lwd=2)

HISTOGRAM Dist. of Height for Female Participants Dist. of Height for Male Participants Density 0.00 0.02 0.04 0.06 0.08 Density 0.00 0.02 0.04 0.06 0.08 140 150 160 170 180 190 Height 140 150 160 170 180 190 Height

par(mfrow=c(1,1)) plot(dens.f,col='blue',lwd=2, ylab='density', xlim=c(140,190), main="dist. of Height by gender",xlab='height') lines(dens.m,col='green',lwd=2) legend("topleft", c('female','male'), col=c('blue','green'), cex=1.5,lwd=2)

# text(x, y, TEXT ) text(x = 157.5, y = 0.04, 'Female', col='blue', cex=2) text(x = 170, y = 0.04,'Male', col='green', cex=2) Dist. of Height by gender density 0.00 0.02 0.04 0.06 Female Male 140 150 160 170 180 190 Height

21 22 23 24 25 1 2 3 4 5 16 17 18 19 20 11 12 13 14 15 6 7 8 9 10 1 2 3 4 5 1 2 3 4 5

# plot(x,y, ) plot(dat$shoesize, dat$h, main="relationship b/w shoesize and height, xlab = 'shoesize, ylab='height, pch=19, col='red ) Relationship b/w shoesize and height height 150 160 170 180 21 22 23 24 25 26 27 28 shoesize

txt = paste("r =",round(cor(dat$shoesize,dat$h), 4)) > txt[1] "r = 0.875" # paste a=1:3 paste("s",a) => [1] "s 1" "s 2" "s 3" paste( s, a, sep= ) => [1] "s1" "s2" "s3 # round > cor(dat$shoesize,dat$h) [1] 0.8749517 > round(cor(dat$shoesize,dat$h),4) [1] 0.875

txt = paste("r =", round(cor(dat$shoesize,dat$h), 4)) text(22, 175, txt, cex = 1.5) Relationship b/w shoesize and height height 150 160 170 180 r = 0.874 21 22 23 24 25 26 27 28 shoesize

abline: abline(h = mean(dat$h), col='blue'); abline(v = mean(dat$shoesize), col='green'); H V height 150 160 170 180 r = 0.874 mean height Relationship b/w shoesize and height mean shoesize 21 22 23 24 25 26 27 28 shoesize

abline(lm(dat$h~dat$shoesize), lty=2, lwd=2) Relationship b/w shoesize and height height 150 160 170 180 r = 0.874 21 22 23 24 25 26 27 28 shoesize

plot(dat[dat$gender=='f',]$shoesize, dat[dat$gender=='f',]$h, main="relationship b/w shoesize and height", xlab='shoesize', ylab='height', cex.lab=1.5, pch=19, col='blue', xlim=c(20,29), ylim=c(140,190)) Relationship b/w shoesize and height height 140 150 160 170 180 190 Female Male 20 22 24 26 28 shoesize

plot(dat[dat$gender=='m',]$shoesize, dat[dat$gender=='m',]$h, main="relationship b/w shoesize and height", xlab='shoesize', ylab='height', cex.lab=1.5, pch=15, col='green', xlim=c(20,29), ylim=c(140,190)) Relationship b/w shoesize and height height 140 150 160 170 180 190 Female Male 20 22 24 26 28 shoesize

Relationship b/w shoesize and height height 140 150 160 170 180 190 Female Male 20 22 24 26 28 shoesize

plot(dat[dat$gender=='f',]$shoesize, dat[dat$gender=='f',]$h, main="relationship b/w shoesize and height", xlab='shoesize', ylab='height', cex.lab=1.5, pch=19, col='blue', xlim=c(20,29), ylim=c(140,190)) points(dat[dat$gender=='m',]$shoesize,dat[dat$gender=='m',]$h, pch = 15, col = 'green') legend("topleft", c('female','male'), pch =c(19,15), col = c('blue','green'), cex = 1.5) points: lines height 140 150 160 170 180 190 Female Male Relationship b/w shoesize and height 20 22 24 26 28 shoesize

dat<-read.csv("http://www.matsuka.info/data_folder/tdkreg01.csv") plot(dat, pch=20, col='blue') 100 140 180 50 100 150 200 material 2 4 6 8 10 100 140 180 price design 10 30 50 70 50 100 150 200 sales 2 4 6 8 10 10 20 30 40 50 60 70

plot(dat.pca, pch = rownames(dat.pca), cex = 1.7, col = 'blue ) 40 50 60 70 80 90 > dat.pca writing thesis interview a 88 70 65 b 52 78 88 c 77 87 89 d 35 40 43 e 60 43 40 f 97 95 91 g 48 62 83 h 66 66 65 i 78 50 48 40 50 60 70 80 90 d d writing c b g h i e b c g h i e a a f f e d d e i i a h g b thesis b g ha c c f f e d e d i i a h a h interview c g b g b f f c 40 50 60 70 80 90 40 50 60 70 80 90 40 50 60 70 80 90 40 50 60 70 80 90

( "% " = $ %&' )

! = # $ = $ % & % + $ ( & ( + + $ * & * = + $, &, *,-%! = # $ = $ % & % + $ ( & ( + + $ * & * =. 0 /0 $1 $ 2$

! " # = %&' ( = ) ( + # = ) ( ) ( # %&' ( = (, + # -, + ( # + # - # + + ( 0 + # - 0 = 1 = 1 2 = 1 2 ( 2 # 2( 2 + + + # - 2 = 1 2 ( 2 # - 2 2+ 1 = ) ( # 2+ 5 + + + # 5 1 = ) ( # ) ( # 2 ( 2-2 + 1 2 + # - 2 0 23, ( 2 # - 2 2( 2 +- 2 + + # - 2 ( 2 + # - 2

! " = $%&&'( = ()*

! $ "# = &'( ), + =, ), ), +, + =, )+, ) +, + ) +, ), + =, )+, ), +, ), + +, ), + =, )+, ), +! $ "" = &'( ), ) =, )), ), ) =, ) $, ) $ =! $ " = (/0 )

: cov(x,y) = cov(y,x) cov(x,x) = var(x) cov(ax, by) = ab*cov(x,y) cov(a+x, b+y) = cov(x,y) cov(x, Y+Z) = cov(x,y)+cov(x,z) cov(σx, ΣY)=ΣΣcov(X,Y)

" #$ = &'(( ), + = &',(), +),/( ),/((+)

( "% " = $ %&' ( * +, = $ %&' ) ( /01 = $ %&' " % ", ) 1 /01(", 2) 4 = * + * 8 " % " 2 % 32 ) 1 9 = : " ; +, = : " 9, = : " : ", ; +8 = : " : " : 2 : 2 /01(", 2) < = 1=4 " 1=4(2)

! " # = % ) *&,- # &'(. 1 ). 1! " # = % &'( ) = % &'( ) = % &'( ) = % &'( ) * &,- # = % &'( ) * & 1 # + % &'( ) * & + 1 1,- # = % &'( ),- 1 # 2,- 1 % &'( * & 1 # +.,- 1 # 2,- 1.,- 1 * & 1 #.,- 1 #. 1 3! # " = % 3 * & 1 #.3,- 1 # 3! " # = 4 " # ) &'( =.4 " #.4, 5 # =.4 # ". 4 " #. =. 1 4 # " * & + 1,- 1 # * & 1

( ) = E ( X 1 ) + E ( X 2 ) +!+ E ( X n ) = µ + µ +!+ µ = nµ ( ) = var( X 1 ) + var( X 2 ) +!+ var( X n ) = σ 2 +σ 2 +!+σ 2 = nσ 2 E X 1 + X 2 +!+ X n var X 1 + X 2 +!+ X n ( ) = E X 1 + X 2 +!+ X # n E X var X! " ( ) = var! # " n X 1 + X 2 +!+ X n n $! & = E X $! 1 # &+!+ E X $ n # & = nµ % " n % " n % n = µ $ & = 1 % n var X 2 1 ( ) +!+ 1 n var ( X 2 n) = nσ 2 = σ 2 n 2 n

dat<-read.table("http://www.matsuka.info/data_folder/aov01.txt",header=t) > head(dat) shoesize h gender affil club 1 27.0 181.4 M psy tetsudo 2 26.5 170.8 M cs tennis 3 27.5 182.3 M psy karate 4 26.5 166.8 M psy tennis 5 23.5 153.2 F cs tetsudo 6 23.0 151.6 F psy tennis > summary(dat) shoesize h gender affil club Min. :21.00 Min. :145.0 F:36 cs :35 karate :24 1st Qu.:23.50 1st Qu.:157.2 M:34 psy:35 tennis :23 Median :24.50 Median :164.0 tetsudo:23 Mean :24.82 Mean :164.1 3rd Qu.:26.38 3rd Qu.:170.9 Max. :28.00 Max. :182.3

> mean(dat$shoesize) [1] 24.82143 > mean(dat$h) [1] 164.1443 > var(dat$shoesize) [1] 2.652433 > var(dat$h) [1] 83.97352 > cov(dat[,1:2]) shoesize h shoesize 2.652433 13.05802 h 13.058023 83.97352 > cor(dat[,1:2]) shoesize h shoesize 1.0000000 0.8749517 h 0.8749517 1.0000000

)! "# = % &'( ) "* & + & = "* ( + ( + "* - + - + + "* ) + ) = " % * & + & = "! "# &'( > dat.meter = dat[,1:2]*0.01 > mean(dat.meter$h) [1] 1.641443 > mean(dat$h)*0.01 [1] 1.641443 > mean(dat$h) [1] 164.1443

*! " + $ = & '() * + ', ' + $ &, ' = & + ', ' + $ - 1 =! " + $ '() * '() > dat.h.ext5 = dat$h+5 [1] 160 153 155 181 170 167 153 163 157 169 > mean(dat.h.ext5) [1] 169.1443 > mean(dat$h) [1] 164.1443 > mean(dat$h)+5 [1] 169.1443

*! " + $ = & + ', " = + ' + & - ', $ = - ' =! " +! $ '() * '() > handshoe = dat$h+dat$shoesize > mean(handshoe) [1] 188.9657 > mean(dat$h)+mean(dat$shoesize) [1] 188.9657

! "# + % =! "# +! % = "! # + % > dat.h.meter.ext5 = dat$h*0.01+0.05 > mean(dat.h.meter.ext5) [1] 1.691443 > 0.01*mean(dat$h)+0.05 [1] 1.691443

!"# $% = ' $% ' $% ) > var(dat.meter$h) [1] 0.008397352 = ' $% $* ) = ' $ ) % * ) = $ ) ' % * ) = $ )!"# % > var(dat$h)*(0.01^2) [1] 0.008397352

!"# $ + & = ( $ + & ( $ + & = ( $ + & + + & * = ( $ + * =!"# $ * > var(dat.h.ext5) [1] 83.97352 > var(dat$h) [1] 83.97352

!"# $% + ' = ) $% + ' ) $% + ' + > var(dat.h.meter.ext5) [1] 0.008397352 > var(dat$h)*(0.01^2) [1] 0.008397352 = ) $% + ' $, + ' + = ) $ % +, + = $ + ) %, + = $ +!"# %

!"# $ + & = ( $ + & * + + *, - > var(handshoe) [1] 112.742 = ( $ + & - 2 $ + & * + + *, + * + + *, - = ( $ - + 2$& + & - + 2$* + 2$*, 2&* + 2&*, + * + - + 2* + *, + *, - = ( $ - 2$* + + * + - + & - 2&*, + *, - + 2$& 2$*, 2&* + + 2* + *, = ( $ * + - + ( & *, - + 2/01 $, & > var(dat$h)+var(dat$shoesize)+2*cov(dat$h,dat$shoesize) [1] 112.742

!"# $, $ = ' $$ ' $ ' $ = ' $ ) ' $ ) = *+, $ > cov(dat$h,dat$h) [1] 83.97352 > var(dat$h) [1] 83.97352

!"# $%, '( = * $% * $% '( * '( = * $'%( * $% '( * '( $% + * $% * '( = $'* %( $'* % * ( $'* % * ( + $'* % * ( = $' * %( * % * ( = $' -!"# %, ( > cov(dat.meter$h,dat.meter$shoesize) [1] 0.001305802 > (0.01*0.01)*cov(dat$h,dat$shoesize) [1] 0.001305802

!"# $ + &, ( + ) = + $ + & + $ + & ( + ) + ( + ) = + $ + & ( + ) + $ + & ( + ) + ( + ) $ + & + + $ + & + ( + ). = + $ + & ( + ) + $ + & + ( + ) + $ + & + ( + ) + + $ + & + ( + ) = + $( + (& + $) + &) $ + + & ( + + ) = $( + (+ & + $+ ) + + &) $( (+ & $+ ) + & + ) = + &) + & + ) =!"# &, ) > cov(dat.h.ext5,dat.ss.ext1) [1] 13.05802 > cov(dat$h,dat$shoesize) [1] 13.05802

!"# $, & + ( = * $ * $ & + ( * & + ( = * $ & + ( * $ & + ( * & + ( $ + * $ * & + (. = * $ & + ( * $ * & + ( * $ * & + ( + * $ * & + ( = * $ & + ( * $ * & + ( = * $& + $( * $ * & + * $ * ( = * $& * $ * & + * $( * $ * ( =!"# $, & +!"# $, ( > cov(dat$h,handshoe) [1] 97.03154 > cov(dat$h,dat$shoesize)+cov(dat$h,dat$h) [1] 97.03154

!"# $1 + $2, )1 + )2 = + $1 + $2 + $1 + $2 )1 + )2 + )1 + )2 = + $1 + $2 )1 + )2 + $1 + $2 + )1 + )2 = + $1)2 + $1)2 + $2)1 + $2)2 + $1 + )1 + + $1 + )2 + + $2 + -1 + + $2 + )2 = + $1)1 + $1 + )1 + + $1)2 + $1 + )2 + + $2)1 + $2 + )1 + + $2)2 + $2 + )2 =!"# $1, )1 +!"# $1, )2 +!"# $2, )1 +!"# $2, )2 =..!"# $ / + ) 0 / 0 123. $ / =..!"# $ / + ) 0 =. 123 $ / +..!"# $ / + $ 0 / / 0 / / 04/ =. 123 $ / +..!"# $ / + $ 0 / / 05/