(2/24) : 1. R R R

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

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

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

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

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

/ 60 : 1. GLM? 2. A: (pwer functin) x y?

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

kubostat2018d p.2 :? bod size x and fertilization f change seed number? : a statistical model for this example? i response variable seed number : { i

12/1 ( ) GLM, R MCMC, WinBUGS 12/2 ( ) WinBUGS WinBUGS 12/2 ( ) : 12/3 ( ) :? ( :51 ) 2/ 71

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

/ 55 2 : : (GLM) 1. 1/23 ( )? GLM? (GLM ) 2.! 1/25 ( ) ffset (GLM )

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

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

60 (W30)? 1. ( ) 2. ( ) web site URL ( :41 ) 1/ 77

kubostat7f p GLM! logistic regression as usual? N? GLM GLM doesn t work! GLM!! probabilit distribution binomial distribution : : β + β x i link functi

Use R

,, Poisson 3 3. t t y,, y n Nµ, σ 2 y i µ + ɛ i ɛ i N0, σ 2 E[y i ] µ * i y i x i y i α + βx i + ɛ i ɛ i N0, σ 2, α, β *3 y i E[y i ] α + βx i

1 15 R Part : website:

AP_12_15_yonezawa.indd

R John Fox R R R Console library(rcmdr) Rcmdr R GUI Windows R R SDI *1 R Console R 1 2 Windows XP Windows * 2 R R Console R ˆ R

(lm) lm AIC 2 / 1

kubo2017sep16a p.1 ( 1 ) : : :55 kubo ( ( 1 ) / 10

kubostat2017b p.1 agenda I 2017 (b) probability distribution and maximum likelihood estimation :

1 Tokyo Daily Rainfall (mm) Days (mm)


: (GLMM) (pseudo replication) ( ) ( ) & Markov Chain Monte Carlo (MCMC)? /30

kubostat2017j p.2 CSV CSV (!) d2.csv d2.csv,, 286,0,A 85,0,B 378,1,A 148,1,B ( :27 ) 10/ 51 kubostat2017j (

パーキンソン病治療ガイドライン2002

p.1/22

R Console >R ˆ 2 ˆ 2 ˆ Graphics Device 1 Rcmdr R Console R R Rcmdr Rcmdr Fox, 2007 Fox and Carvalho, 2012 R R 2

研修コーナー

抄録/抄録1    (1)V

1 Stata SEM LightStone 4 SEM 4.. Alan C. Acock, Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press 3.

2 と入力すると以下のようになる > x1<-c(1.52,2,3.01,9,2,6.3,5,11.2) > y1<-c(4,0.21,-1.5,8,2,6,9.915,5.2) > cor(x1,y1) [1] > cor.test(x1,y1) Pearson's produ



人事行政の運営状況等の公表(平成19年12月)(PDF)


mogiJugyo_slide_full.dvi

2

PSCHG000.PS


プログラム 3日目:11月16日(日曜日)

0428_HP用.pdf

untitled

新たな基礎年金制度の構築に向けて

PSCHG000.PS


apli_connection

PDF


JSP58-program


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

鹿大広報148号

鹿大広報151


2 / 39

2.1 R, ( ), Download R for Windows base. R ( ) R win.exe, 2.,.,.,. R > 3*5 # [1] 15 > c(19,76)+c(11,13)

第90回日本感染症学会学術講演会抄録(I)

03.Œk’ì

(1)2004年度 日本地理

% 10%, 35%( 1029 ) p (a) 1 p 95% (b) 1 Std. Err. (c) p 40% 5% (d) p 1: STATA (1). prtesti One-sample test of pr

Ł\”ƒ-2005


1409.indd

untitled

untitled




FREE


untitled

(2) Fisher α (α) α Fisher α ( α) 0 Levi Civita (1) ( 1) e m (e) (m) ([1], [2], [13]) Poincaré e m Poincaré e m Kähler-like 2 Kähler-like


GLM PROC GLM y = Xβ + ε y X β ε ε σ 2 E[ε] = 0 var[ε] = σ 2 I σ 2 0 σ 2 =... 0 σ 2 σ 2 I ε σ 2 y E[y] =Xβ var[y] =σ 2 I PROC GLM

みっちりGLM

Q 23 A Q Q15 76 Q23 77

[ ] =. =3.5 3 =.3 =. =0.30 : (f i ) u i u i f i u i f i

「産業上利用することができる発明」の審査の運用指針(案)

2007.3„”76“ƒ



sayo pdf

月信11-12pdf用.indd

広報ちくしの_ indd


レッツ中央205号.indd

えふ・サポート-113号-162.indd




d


レッツ中央210号.indd


レッツ中央212号.indd

0405宅建表01.indd

広報ちくしの_ indd

Transcription:

R? http://hosho.ees.hokudai.ac.jp/ kubo/ce/2004/ : kubo@ees.hokudai.ac.jp

(2/24) : 1. R 2. 3. R R

(3/24)? 1. ( ) 2. ( I ) : (p ) : cf. (power) p?

(4/24) p ( ) I p ( ) I? ( )

(5/24)? 0 2 4 6 8 A B A B (control) B I ( p )? (p )

(6/24)? 1. ( ) 2. ( ) 3. 4. 5. ( ) : ( ) AIC Akaike s Information Criteria ( ) AIC = 2( ) +2 ( ) ( ) ( )

(7/24) : R http://www.r-project.org/ OS free software S The R Book (2004) Modern Applied Statistics With S Venables & Ripley (2002) Introductory Statistics with R P. Dalgaard (2002) ( )

[ ] 1. 2. R 3.

(9/24) : B A 0 2 4 6 8 A A (A) 20 2.5 B (B) 10 3.5 (C) 20 3.5 B, : :

(10/24) 0 2 4 6 8 A B (A+B+C)? (A+B)(C)? (A+C)(B)? (A)(B+C)? ( ) (A)(B)(C)?? ( ) A ((A)) B ((B)) ((C))? (? )

(11/24)! 1.? : {, }, : {0.56, 1.33, 12.4, 9.84, } 2.? {0, 1,, N}, {0, 1,, }, [y min, y max ], [, ], 3. ( )?,,, n,

(12/24) (Poisson distribution) y i {0, 1, 2,, } (paramter: λ) R : dpois(y, λ) 0.4 λ y exp( λ) y! λ λ : 0.0 0 2 4 6 8 10 y 0.3 0.2 0.1?

(13/24) [ ] [ (GLM)] + [ ] +

(14/24) (generalized linear model, glm()) ( ) link : ( ) link(µ(x)) = β 0 1 + β 1 x 1 + β 2 x 2 + = i β i x i R glm() stepaic() AIC

(15/24) R (glm()) ( ) rbinom() rbinom() rpois() rnbinom() ( ) rgamma() rnorm() glm(family = binom) glm(family = binom) glm(family = poisson) glm.nb() glm(family = gamma) glm(family = gaussian) glm() glm.nb() MASS library rnegbin()

(16/24) 1. ( ) level n.flower A 3 A 0 A 1 B 4 B 1 B 2 C 5 C 4 C 2 0 2 4 6 8 A B level: A A B B C n.flower: n.flower {0, 1, 2, }

(17/24) 2. (A - B - C) 0 2 4 6 8 A B (A+B+C) 1 (A+B)(C) 2 (A+C)(B) 2 (A)(B+C) 2 (A)(B)(C) 3 : (A)(B+C) A (A) B (B+C) C (B+C) level n.flower level.mapped A 3 (A) B 4 (B+C) C 5 (B+C)

(18/24) 3. R glm() 0 2 4 6 8 A B (A+B)(C), (A+C)(B), (A)(B+C), (A)(B)(C) glm() : glm(n.flower level.mapped - 1, family = poisson(link = log)) (A+B+C) glm() : glm(n.flower 1, family = poisson(link = log))

(19/24) 4. AIC = 2( ) +2 ( ) ( ) ( ) > result <- glm(n.flower level.mapped - 1, family = poisson(link... > result # Call: glm(formula = n.flower level.mapped - 1, family = poisson(... Coefficients: level.mapped(a) level.mapped(b+c) 0.875 1.243 Degrees of Freedom: 50 Total (i.e. Null); Null Deviance: 189 Residual Deviance: 50.2 AIC: 193 > result$aic # AIC [1] 192.91 48 Residual

(20/24) 5. AIC > results <- estimate.poisson(samples) > cat(sapply(results, function(r) sprintf("model %-12s, AIC = %.1f", r$tag, r$glm$aic)), sep = "\n") Model (A+B+C), AIC = 195.5 Model (A+B)(C), AIC = 194.7 Model (A+C)(B), AIC = 197.3 Model (A)(B+C), AIC = 192.9 Model (A)(B)(C), AIC = 194.8 0 2 4 6 8 A B AIC ( ) estimate.poisson() ( glm() AIC ) R

(21/24) :? : familywise : A = B B = C A C ; : -

R R

(23/24)? R generate.groups() (4 ) > sapply(generate.groups(c("a", "B", "C", "D")), function(g) g$tag) [1] "(A+B+C+D)" "(A+B+C)(D)" "(A+B+D)(C)" "(A+C+D)(B)" "(A)(B+C+D)" [6] "(A+B)(C+D)" "(A+C)(B+D)" "(A+D)(B+C)" "(A+B)(C)(D)" "(A+C)(B)(D)" [11] "(A+D)(B)(C)" "(A)(B+C)(D)" "(A)(B+D)(C)" "(A)(B)(C+D)" "(A)(B)(C)(D)" (?) partition.int(): generate.groups(): estimate.poisson(): generate.groups()

(24/24) 1. I?? 2. AIC 3. R ( ) R (multcomp library )