お気付きの点がありましたらご指摘いただけますと幸いです。
- R を用いた一般化線形モデル(仮説検定編):割合データを例に(2022年5月4日参照).
- statistics - Asterisk (*) vs. colon (:) in R formulas - Stack Overflow(2022年5月5日参照).
💜
💛
- 参考文献 [1] によると、草の種子の中には、乾燥したままの種子を蒔くよりも、種子を予め低温で湿度が高い環境で保存してから蒔いた方が発芽率が高くなるものがあるのですね? 種子に「いま冬を越えたから発芽しよう(?)」と思わせる効果があると。しかし、[1] の 2 ページ目の架空データの種子は乾燥したまま(control)でもある程度の発芽率はありますね? 彼らは何なんです? 「冬を越えたかわからないけど発芽してヨシ(?)」とでも?
- 知らないよ。その「何が種子の発芽率に影響を及ぼすのか」を考察するために分散分析モデルをつかおうという話じゃないか。
- そうですね。[1] のデータを [1] 内のコードでロジスティック回帰すると以下です。なお、germinated 列と not 列は発芽した種子数と発芽しなかった種子数で、2列合わせて今回の被説明変数ですね。そして、treatment 列が低温湿潤処理(stratification)をしたかどうかで、condition 列は明るい環境(light)だったか暗い環境だったかです。
data <- read.delim("data.txt") fit <- glm( cbind(germinated, not) ~ treatment*condition, data=data, family=binomial(link="logit") ) print(summary(fit))
Deviance Residuals: Min 1Q Median 3Q Max -2.1007 -1.0798 -0.1452 0.5999 3.0857 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -2.3403 0.2904 -8.059 7.67e-16 *** treatmentstratification 1.8508 0.3356 5.515 3.49e-08 *** conditionlight 1.9969 0.3352 5.958 2.56e-09 *** treatmentstratification:conditionlight -0.4957 0.4180 -1.186 0.236 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 184.738 on 23 degrees of freedom Residual deviance: 42.253 on 20 degrees of freedom AIC: 126.28 Number of Fisher Scoring iterations: 4
print(anova(fit, test="Chisq"))
Analysis of Deviance Table Model: binomial, link: logit Response: cbind(germinated, not) Terms added sequentially (first to last) Df Deviance Resid. Df Resid. Dev Pr(>Chi) NULL 23 184.738 treatment 1 58.901 22 125.837 1.658e-14 *** condition 1 82.143 21 43.694 < 2.2e-16 *** treatment:condition 1 1.441 20 42.253 0.2299