xingzhaoh 发表于 2012-4-17 15:44 
数来指点一下呀
底下是"一楼程序"的结果
"地板程序"请自行参考修改
library( systemfit )
rd<-read.csv("sysfit_123.csv")
STEM.formula<-STEM~ a1*DBH^b1/( a1*DBH^b1+ a2*DBH^b2+ a3*DBH^b3+ a4*DBH^b4+ a5*DBH^b5)* (a0*DBH^b0)
SKIN.formula<-SKIN~ a2*DBH^b2/( a1*DBH^b1+ a2*DBH^b2+ a3*DBH^b3+ a4*DBH^b4+ a5*DBH^b5)* (a0*DBH^b0)
LEAF.formula<-LEAF~ a3*DBH^b3/( a1*DBH^b1+ a2*DBH^b2+ a3*DBH^b3+ a4*DBH^b4+ a5*DBH^b5)* (a0*DBH^b0)
BRANCH.formula<-BRANCH~ a4*DBH^b4/( a1*DBH^b1+ a2*DBH^b2+ a3*DBH^b3+ a4*DBH^b4+ a5*DBH^b5)* (a0*DBH^b0)
UNDER.formula<-UNDER~ a5*DBH^b5/( a1*DBH^b1+ a2*DBH^b2+ a3*DBH^b3+ a4*DBH^b4+ a5*DBH^b5)* (a0*DBH^b0)
TOTAL.formula<-UNDER~ (a0*DBH^b0)^2/( a1*DBH^b1+ a2*DBH^b2+ a3*DBH^b3+ a4*DBH^b4+ a5*DBH^b5)
labels <- list( " STEM.formula ", " SKIN.formula ", " LEAF.formula ", " BRANCH.formula ",
" UNDER.formula ", " TOTAL.formula ")
inst <- ~ DBH+STEM+SKIN+LEAF+BRANCH+UNDERL+TOTAL
start.values <- c(a0=4.156704e-02,b0= 2.785912e+00,a1=4.978067e-01,b1=6.936570e+00,a2=2.239998e-02,b2=3.479641e+00,
a3=6.343405e-02,b3=1.741423e+00,a4=6.618161e-09,b4=1.189588e+00 ,a5=3.245551e-02,b5=7.341656e+00)
model<-list(STEM.formula,SKIN.formula,LEAF.formula,BRANCH.formula,UNDER.formula, TOTAL.formula)
model.ols <- nlsystemfit( "OLS", model, start.values, data=rd, eqnlabels=labels )
model.ols
#######
nlsystemfit results
method: OLS
convergence achieved after 482 iterations
nlsystemfit objective function value: 20092.5079035206
N DF SSR MSE RMSE R2 Adj R2
STEM.formula 45 37 7174.503 193.90549 13.92499 0.975811 0.971235
SKIN.formula 45 37 183.332 4.95493 2.22597 0.921478 0.906623
LEAF.formula 45 37 445.394 12.03769 3.46954 -0.381186 -0.642492
BRANCH.formula 45 37 8972.203 242.49198 15.57215 -0.773149 -1.108609
UNDER.formula 45 37 1668.063 45.08279 6.71437 0.903839 0.885646
TOTAL.formula 45 37 1649.012 44.56789 6.67592 0.904937 0.886952
The covariance matrix of the residuals
STEM.formula SKIN.formula LEAF.formula BRANCH.formula UNDER.formula TOTAL.formula
STEM.formula 193.90549 5.55291 -7.46467 -42.39716 20.52546 19.99424
SKIN.formula 5.55291 4.95493 3.25544 1.71561 -2.56699 -1.99001
LEAF.formula -7.46467 3.25544 12.03769 21.45441 -4.12993 -2.34953
BRANCH.formula -42.39716 1.71561 21.45441 242.49198 4.30797 4.91108
UNDER.formula 20.52546 -2.56699 -4.12993 4.30797 45.08279 44.56133
TOTAL.formula 19.99424 -1.99001 -2.34953 4.91108 44.56133 44.56789
The correlations of the residuals
STEM.formula SKIN.formula LEAF.formula BRANCH.formula UNDER.formula TOTAL.formula
STEM.formula 1.000000 0.155396 -0.209476 -0.1595122 0.2319603 0.2190200
SKIN.formula 0.155396 1.000000 0.365649 0.3045932 -0.1552202 -0.1330907
LEAF.formula -0.209476 0.365649 1.000000 0.8918697 -0.1576088 -0.1005015
BRANCH.formula -0.159512 0.304593 0.891870 1.0000000 -0.0211297 0.0445799
UNDER.formula 0.231960 -0.155220 -0.157609 -0.0211297 1.0000000 0.9962623
TOTAL.formula 0.219020 -0.133091 -0.100502 0.0445799 0.9962623 1.0000000
The determinant of the residual covariance matrix: 15600226
OLS estimates for STEM.formula (equation 1)
Model Formula: STEM ~ a1 * DBH^b1/(a1 * DBH^b1 + a2 * DBH^b2 + a3 * DBH^b3 +
a4 * DBH^b4 + a5 * DBH^b5) * (a0 * DBH^b0)
Estimate Std. Error t value Pr(>|t|)
a0 0.134917 0.032681 4.128299 2e-04 ***
b0 2.415232 0.07743 31.192562 0 ***
a1 0.911267 0.428583 2.126235 0.040219 *
b1 2.269549 0.150539 15.076108 0 ***
a2 1.353893 0.542256 2.496778 0.017112 *
b2 1.387021 0.130171 10.655388 0 ***
a3 189.636947 94.542823 2.005831 0.052228 .
b3 -0.673773 0.185336 -3.635424 0.000839 ***
a4 0 1.330123 0 1
b4 1.557165 60307107.744117 0 1
a5 0.089036 0.022385 3.977547 0.000311 ***
b5 2.54723 0.080334 31.70814 0 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 13.924995 on 37 degrees of freedom
Number of observations: 45 Degrees of Freedom: 37
SSR: 7174.502977 MSE: 193.905486 Root MSE: 13.924995
Multiple R-Squared: 0.975811 Adjusted R-Squared: 0.971235
OLS estimates for SKIN.formula (equation 2)
Model Formula: SKIN ~ a2 * DBH^b2/(a1 * DBH^b1 + a2 * DBH^b2 + a3 * DBH^b3 +
a4 * DBH^b4 + a5 * DBH^b5) * (a0 * DBH^b0)
Estimate Std. Error t value Pr(>|t|)
a0 0.134917 0.032681 4.128299 2e-04 ***
b0 2.415232 0.07743 31.192562 0 ***
a1 0.911267 0.428583 2.126235 0.040219 *
b1 2.269549 0.150539 15.076108 0 ***
a2 1.353893 0.542256 2.496778 0.017112 *
b2 1.387021 0.130171 10.655388 0 ***
a3 189.636947 94.542823 2.005831 0.052228 .
b3 -0.673773 0.185336 -3.635424 0.000839 ***
a4 0 1.330123 0 1
b4 1.557165 60307107.744117 0 1
a5 0.089036 0.022385 3.977547 0.000311 ***
b5 2.54723 0.080334 31.70814 0 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.225967 on 37 degrees of freedom
Number of observations: 45 Degrees of Freedom: 37
SSR: 183.33231 MSE: 4.954927 Root MSE: 2.225967
Multiple R-Squared: 0.921478 Adjusted R-Squared: 0.906623
OLS estimates for LEAF.formula (equation 3)
Model Formula: LEAF ~ a3 * DBH^b3/(a1 * DBH^b1 + a2 * DBH^b2 + a3 * DBH^b3 +
a4 * DBH^b4 + a5 * DBH^b5) * (a0 * DBH^b0)
Estimate Std. Error t value Pr(>|t|)
a0 0.134917 0.032681 4.128299 2e-04 ***
b0 2.415232 0.07743 31.192562 0 ***
a1 0.911267 0.428583 2.126235 0.040219 *
b1 2.269549 0.150539 15.076108 0 ***
a2 1.353893 0.542256 2.496778 0.017112 *
b2 1.387021 0.130171 10.655388 0 ***
a3 189.636947 94.542823 2.005831 0.052228 .
b3 -0.673773 0.185336 -3.635424 0.000839 ***
a4 0 1.330123 0 1
b4 1.557165 60307107.744117 0 1
a5 0.089036 0.022385 3.977547 0.000311 ***
b5 2.54723 0.080334 31.70814 0 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 3.469537 on 37 degrees of freedom
Number of observations: 45 Degrees of Freedom: 37
SSR: 445.394437 MSE: 12.037687 Root MSE: 3.469537
Multiple R-Squared: -0.381186 Adjusted R-Squared: -0.642492