No.09391 適合度検定  【GLM初心者】 2009/03/01(Sun) 10:41

はじめまして。GLM初心者です。現在,適合度検定をGLMの手法で行うことを試みております。具体的なデータは,下記です。
遺 伝学的表現型(A, B, C, D)を示す植物がそれぞれ 150, 42, 50, 8 個体得られたとします。 理論的には,表現型の比は,A:B:C:D = 9:3:3:1 です。実験で得られた数値は,理論値に適合しているかどうかをGLMの手法で解析したく考えております。青木先生がホームページで示されている下記の方法 は,すでに,確認しております
#####
w<-as.matrix(c(150,42,50,8)) #適合度検定
dim(w)<-c(1,4)
w
chisq.test(w,p=c(9/16,3/16,3/16,1/16))
## 解析結果
> w<-as.matrix(c(150,42,50,8))#適合度検定
> dim(w)<-c(1,4)
> w
[,1] [,2] [,3] [,4]
[1,] 150 42 50 8
> chisq.test(w,p=c(9/16,3/16,3/16,1/16))

Chi-squared test for given probabilities

data: w
X-squared = 5.0613, df = 3, p-value = 0.1674
現在,GLM解析で,family=poissonを試みております(下記)。

#### data
species phenotype count
wild A 140.625
wild B 46.875
wild C 46.875
wild D 15.625
mutant A 150
mutant B 42
mutant C 50
mutant D 8
理論比率 p=c(9/16,3/16,3/16,1/16)に相当するデータを,調べたい植物(mutant)に対して,野性型(wild)に比率を同じにして振り分けております。GLMでのモデル式は,下記のように設定して,解析を行いました。
model01<-glm(count~species*phenotype,family=poisson)
model02<-update(model01,~.-species:phenotype)
anova(model01,model02,test="Chisq")
このとき,
> model01<-glm(count~species*phenotype,family=poisson)
Warning messages:
1: In dpois(y, mu, log = TRUE) : non-integer x = 140.625000
2: In dpois(y, mu, log = TRUE) : non-integer x = 46.875000
3: In dpois(y, mu, log = TRUE) : non-integer x = 46.875000
4: In dpois(y, mu, log = TRUE) : non-integer x = 15.625000
>
> model02<-update(model01,~.-species:phenotype)
Warning messages:
1: In dpois(y, mu, log = TRUE) : non-integer x = 140.625000
2: In dpois(y, mu, log = TRUE) : non-integer x = 46.875000
3: In dpois(y, mu, log = TRUE) : non-integer x = 46.875000
4: In dpois(y, mu, log = TRUE) : non-integer x = 15.625000
の警告が出ます。また,解析結果として,
> anova(model01,model02,test="Chisq")
Analysis of Deviance Table

Model 1: count ~ species * phenotype
Model 2: count ~ species + phenotype
Resid. Df Resid. Dev Df Deviance P(>|Chi|)
1 0 1.682e-14
2 3 3.1764 -3 -3.1764 0.3652
が得られます。

質問:
(1)警告への対処方法
(2)GLM解析での P(>|chi|)値0.3652が,Chi-squared test for given probabilities解析での p-value 値 0.1674 とこなる理由
(3)GLMでの解析方法

以上の質問です。お忙しいところ申し訳ございません。教えていただければ幸いです。よろしくお願い申し上げます。

No.09394 Re: 適合度検定  【青木繁伸】 2009/03/01(Sun) 20:50

>(1)警告への対処方法

family=poisson の場合,従属変数は,整数じゃないとまずいので,警告が出るのは当たり前でしょう。対症療法で警告だけ出なくなればよいというなら,glm(round(count)~species*phenotype,family=poisson) とでもすればよいでしょうが,それが解決策でないのは明らかでしょう。

>(2)GLM解析での P(>|chi|)値0.3652が,Chi-squared test for given probabilities解析での p-value 値 0.1674 とこなる理由

モデルというか解析方法が違うのだから,同じ値が出るわけがない(同じ値が出るのなら,なにも glm なんかやる必要はない)

>(3)GLMでの解析方法

わかりません。

No.09395 Re: 適合度検定  【GLM初心者】 2009/03/01(Sun) 22:46

青木先生

ご回答ありがとうございます。(1)および(2),了解いたしました。(3)については,もっと勉強いたします。

GLM初心者

● 「統計学関連なんでもあり」の過去ログ--- 042 の目次へジャンプ
● 「統計学関連なんでもあり」の目次へジャンプ
● 直前のページへ戻る