> lmresult <- lm(NumberOfEggs ? BodyWeight + AgeAtFirstEggs)
> summary(lmresult)
Call:
lm(formula = NumberOfEggs ? BodyWeight + AgeAtFirstEggs)
Residuals:
2 5 6 7 8
-0.74792 -0.20999 -0.06709 0.02638 0.99862
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -16.9522 6.1143 -2.773 0.1092
BodyWeight -0.1244 0.1033 -1.204 0.3518
AgeAtFirstEggs 1.5336 0.1891 8.111 0.0149 *
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
Residual standard error: 0.8961 on 2 degrees of freedom
Multiple R-Squared: 0.9903, Adjusted R-squared: 0.9806
F-statistic: 102.2 on 2 and 2 degrees of freedom, p-value: 0.009692
> gdata <- read.table("gdata.txt")
> gdata
age weight
0 0 6.7
1 1 17.0
2 2 34.5
3 3 56.6
4 4 80.3
5 5 94.6
6 6 100.7
7 7 103.7
8 8 104.9
9 9 103.5
10 10 104.8
11 11 105.7
12 12 106.6
13 13 108.0
14 14 107.9
15 15 107.3
> library(nls)
> attach(gdata)
> result <- nls( weight ? A*(1.0-B*exp(-k*age)), data=gdata, start = list( A=100.0, B=1.0, k=0.1))
> summary(result)
Formula: weight ? A * (1 - B * exp(-k * age))
Parameters:
Estimate Std. Error t value Pr(>|t|)
A 112.62879 3.84595 29.285 2.96e-13 ***
B 1.03429 0.05546 18.648 9.17e-11 ***
k 0.28924 0.03904 7.409 5.13e-06 ***
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
Residual standard error: 7.187 on 13 degrees of freedom
Correlation of Parameter Estimates:
A B
B -0.301
k -0.787 0.5902
> observed <- c(90, 21) > expected <- c( (111*3)/4, 111/4) > expected [1] 83.25 27.75 >カイ自乗値を求めてみる。
> chi <- sum((observed - expected)^2/expected) > chi [1] 2.189189 >カイ自乗分布から下側確率を求める。
> pchisq( chi, length(observed)-1) [1] 0.8610175 >1-0.8610175=0.1389825 となり5%水準でも有意とならないため、 帰無仮説(データは3:1に適合する)は棄却されない。
最終更新年月日 2006年4月10日
佐賀大学農学部動物生産学研究室ywada@cc.saga-u.ac.jp