xingzhaoh 发表于 2012-3-26 21:23 
谢谢,我明天去试试。
library( systemfit )
rd<-read.csv("data.csv")
BAS.formula <- BAS ~(a1*S1+a2*S2)*SCI^a3*(1-exp(-(k1*S1+k2*S2)*(SDI/10000)^k3*AGE))^c
VOL.formula <- VOL~ BAS *H*(d0/(H+d1))
labels <- list( "bas.growth", "vol.growth" )
inst <- ~ SCI + SDI + AGE +H + BAS+VOL
start.values <- c(a1=2.7, a2=3.8, a3=0.7, k1=1.6, k2=0.0003,k3=0.14, c=0.14,d0=8.7, d1=7.9)
model <- list( BAS.formula, VOL.formula )
model.ols <- nlsystemfit( "OLS", model, start.values, data=rd, eqnlabels=labels )
model.ols
nlsystemfit results
method: OLS
convergence achieved after 393 iterations
nlsystemfit objective function value: 76233.6546406485
N DF SSR MSE RMSE R2 Adj R2
bas.growth 1346 1339 11181.6 8.3507 2.88976 0.843225 0.842523
vol.growth 1346 1344 65052.1 48.4018 6.95714 0.975511 0.975493
The covariance matrix of the residuals
bas.growth vol.growth
bas.growth 8.35070 5.58642
vol.growth 5.58642 48.40184
The correlations of the residuals
bas.growth vol.growth
bas.growth 1.000000 0.278503
vol.growth 0.278503 1.000000
The determinant of the residual covariance matrix: 372.981
OLS estimates for bas.growth (equation 1)
Model Formula: BAS ~ (a1 * S1 + a2 * S2) * SCI^a3 * (1 - exp(-(k1 * S1 + k2 *
S2) * (SDI/10000)^k3 * AGE))^c
Estimate Std. Error t value Pr(>|t|)
a1 6.448497 0.498931 12.924636 0 ***
a2 6.600927 0.528995 12.478252 0 ***
a3 0.763467 0.025538 29.895747 0 ***
k1 0.278089 0.034479 8.065529 0 ***
k2 0.239015 0.033888 7.053039 0 ***
k3 1.029892 0.023882 43.124602 0 ***
c 1.048591 0.050071 20.942133 0 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.889757 on 1339 degrees of freedom
Number of observations: 1346 Degrees of Freedom: 1339
SSR: 11181.584959 MSE: 8.350698 Root MSE: 2.889757
Multiple R-Squared: 0.843225 Adjusted R-Squared: 0.842523
OLS estimates for vol.growth (equation 2)
Model Formula: VOL ~ BAS * H * (d0/(H + d1))
Estimate Std. Error t value Pr(>|t|)
d0 8.711485 0.128352 67.871943 0 ***
d1 7.895171 0.305371 25.854357 0 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 6.957143 on 1344 degrees of freedom
Number of observations: 1346 Degrees of Freedom: 1344
SSR: 65052.069682 MSE: 48.401838 Root MSE: 6.957143
Multiple R-Squared: 0.975511 Adjusted R-Squared: 0.975493