Errors in running code in vignettes:
when running code in 'systemfit.Rnw'

> options(prompt = "R> ", ctinue = "+  ")

> library("systemfit")
Loading required package: Matrix
Loading required package: car
Loading required package: carData
Loading required package: lmtest
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric


Please cite the 'systemfit' package as:
Arne Henningsen and Jeff D. Hamann (2007). systemfit: A Package for Estimating Systems of Simultaneous Equations in R. Journal of Statistical Software 23(4), 1-40. http://www.jstatsoft.org/v23/i04/.

If you have questions, suggestions, or comments regarding the 'systemfit' package, please use a forum or 'tracker' at systemfit's R-Forge site:
https://r-forge.r-project.org/projects/systemfit/

> data("Kmenta")

> attach(Kmenta)

> eqDemand <- consump ~ price + income

> eqSupply <- consump ~ price + farmPrice + trend

> eqSystem <- list(demand = eqDemand, supply = eqSupply)

> fitols <- systemfit(eqSystem)

> print(fitols)

systemfit results 
method: OLS 

Coefficients:
demand_(Intercept)       demand_price      demand_income supply_(Intercept) 
         99.895423          -0.316299           0.334636          58.275431 
      supply_price   supply_farmPrice       supply_trend 
          0.160367           0.248133           0.248302 

> fitsur <- systemfit(eqSystem, method = "SUR")

> fit3sls <- systemfit(eqSystem, method = "3SLS", inst = ~income + 
+     farmPrice + trend)

> fit3sls2 <- systemfit(eqSystem, method = "3SLS", inst = list(~farmPrice + 
+     trend, ~income + farmPrice + trend))

> fitsur <- systemfit(eqSystem, method = "SUR", data = Kmenta)

> restrict <- "demand_price + supply_farmPrice = 0"

> fitsurRmat <- systemfit(eqSystem, method = "SUR", 
+     restrict.matrix = restrict)

> Rmat <- matrix(0, nrow = 1, ncol = 7)

> Rmat[1, 2] <- 1

> Rmat[1, 6] <- 1

> qvec <- c(0)

> fitsurRmatNum <- systemfit(eqSystem, method = "SUR", 
+     restrict.matrix = Rmat, restrict.rhs = qvec)

> modRegMat <- matrix(0, nrow = 7, ncol = 6)

> modRegMat[1:5, 1:5] <- diag(5)

> modRegMat[6, 2] <- -1

> modRegMat[7, 6] <- 1

> fitsurRegMat <- systemfit(eqSystem, method = "SUR", 
+     restrict.regMat = modRegMat)

> all.equal(coef(fitsurRmat), coef(fitsurRmatNum))
[1] TRUE

> all.equal(coef(fitsurRmat), coef(fitsurRegMat))
[1] TRUE

> fitsurit <- systemfit(eqSystem, method = "SUR", maxiter = 500)

> summary(fitsur)

systemfit results 
method: SUR 

        N DF     SSR  detRCov   OLS-R2 McElroy-R2
system 40 33 169.741 0.879285 0.683453   0.788722

        N DF      SSR     MSE    RMSE       R2   Adj R2
demand 20 17  65.6829 3.86370 1.96563 0.755019 0.726198
supply 20 16 104.0584 6.50365 2.55023 0.611888 0.539117

The covariance matrix of the residuals used for estimation
        demand  supply
demand 3.72539 4.13696
supply 4.13696 5.78444

The covariance matrix of the residuals
        demand  supply
demand 3.86370 4.92431
supply 4.92431 6.50365

The correlations of the residuals
         demand   supply
demand 1.000000 0.982348
supply 0.982348 1.000000


SUR estimates for 'demand' (equation 1)
Model Formula: consump ~ price + income

              Estimate Std. Error  t value   Pr(>|t|)    
(Intercept) 99.3328942  7.5144525 13.21891 2.2597e-10 ***
price       -0.2754857  0.0885091 -3.11251  0.0063324 ** 
income       0.2985505  0.0419454  7.11760 1.7249e-06 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.96563 on 17 degrees of freedom
Number of observations: 20 Degrees of Freedom: 17 
SSR: 65.682902 MSE: 3.8637 Root MSE: 1.96563 
Multiple R-Squared: 0.755019 Adjusted R-Squared: 0.726198 


SUR estimates for 'supply' (equation 2)
Model Formula: consump ~ price + farmPrice + trend

              Estimate Std. Error t value   Pr(>|t|)    
(Intercept) 61.9661660 11.0807901 5.59222 4.0480e-05 ***
price        0.1468841  0.0944351 1.55540 0.13940780    
farmPrice    0.2140040  0.0398684 5.36776 6.2829e-05 ***
trend        0.3393039  0.0679113 4.99628 0.00013185 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.550226 on 16 degrees of freedom
Number of observations: 20 Degrees of Freedom: 16 
SSR: 104.05843 MSE: 6.503652 Root MSE: 2.550226 
Multiple R-Squared: 0.611888 Adjusted R-Squared: 0.539117 


> summary(fitsur, residCov = FALSE, equations = FALSE)

systemfit results 
method: SUR 

        N DF     SSR  detRCov   OLS-R2 McElroy-R2
system 40 33 169.741 0.879285 0.683453   0.788722

        N DF      SSR     MSE    RMSE       R2   Adj R2
demand 20 17  65.6829 3.86370 1.96563 0.755019 0.726198
supply 20 16 104.0584 6.50365 2.55023 0.611888 0.539117


Coefficients:
                     Estimate Std. Error  t value   Pr(>|t|)    
demand_(Intercept) 99.3328942  7.5144525 13.21891 2.2597e-10 ***
demand_price       -0.2754857  0.0885091 -3.11251 0.00633240 ** 
demand_income       0.2985505  0.0419454  7.11760 1.7249e-06 ***
supply_(Intercept) 61.9661660 11.0807901  5.59222 4.0480e-05 ***
supply_price        0.1468841  0.0944351  1.55540 0.13940780    
supply_farmPrice    0.2140040  0.0398684  5.36776 6.2829e-05 ***
supply_trend        0.3393039  0.0679113  4.99628 0.00013185 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

> data("GrunfeldGreene")

> library("plm")

> GGPanel <- pdata.frame(GrunfeldGreene, c("firm", "year"))

> greeneSur <- systemfit(invest ~ value + capital, method = "SUR", 
+     data = GGPanel)

> greeneSurPooled <- systemfit(invest ~ value + capital, 
+     method = "SUR", data = GGPanel, pooled = TRUE)

> linearHypothesis(fitsur, Rmat, qvec, test = "FT")
Linear hypothesis test (Theil's F test)

Hypothesis:
demand_price  + supply_farmPrice = 0

Model 1: restricted model
Model 2: fitsur

  Res.Df Df      F Pr(>F)
1     34                 
2     33  1 0.9322 0.3413

> linearHypothesis(fitsur, Rmat, qvec, test = "F")
Linear hypothesis test (F statistic of a Wald test)

Hypothesis:
demand_price  + supply_farmPrice = 0

Model 1: restricted model
Model 2: fitsur

  Res.Df Df      F Pr(>F)
1     34                 
2     33  1 0.6092 0.4407

> linearHypothesis(fitsur, Rmat, qvec, test = "Chisq")
Linear hypothesis test (Chi^2 statistic of a Wald test)

Hypothesis:
demand_price  + supply_farmPrice = 0

Model 1: restricted model
Model 2: fitsur

  Res.Df Df  Chisq Pr(>Chisq)
1     34                     
2     33  1 0.6092     0.4351

> lrtest(fitsurRmat, fitsur)
Likelihood ratio test

Model 1: fitsurRmat
Model 2: fitsur
  #Df  LogLik Df  Chisq Pr(>Chisq)
1   9 -52.117                     
2  10 -51.614  1 1.0043     0.3163

> fit2sls <- systemfit(eqSystem, method = "2SLS", inst = ~income + 
+     farmPrice + trend, data = Kmenta)

> fit3sls <- systemfit(eqSystem, method = "3SLS", inst = ~income + 
+     farmPrice + trend, data = Kmenta)

> hausman.systemfit(fit2sls, fit3sls)

	Hausman specification test for consistency of the 3SLS estimation

data:  Kmenta
Hausman = 2.5357, df = 7, p-value = 0.9244


> hausmantest <- hausman.systemfit(fit2sls, fit3sls)

> library("systemfit")

> data("Kmenta")

> eqDemand <- consump ~ price + income

> eqSupply <- consump ~ price + farmPrice + trend

> inst <- ~income + farmPrice + trend

> system <- list(demand = eqDemand, supply = eqSupply)

> fitOls <- systemfit(system, data = Kmenta)

> round(coef(summary(fitOls)), digits = 4)
                   Estimate Std. Error t value Pr(>|t|)
demand_(Intercept)  99.8954     7.5194 13.2851   0.0000
demand_price        -0.3163     0.0907 -3.4882   0.0028
demand_income        0.3346     0.0454  7.3673   0.0000
supply_(Intercept)  58.2754    11.4629  5.0838   0.0001
supply_price         0.1604     0.0949  1.6901   0.1104
supply_farmPrice     0.2481     0.0462  5.3723   0.0001
supply_trend         0.2483     0.0975  2.5462   0.0216

> fit2sls <- systemfit(system, method = "2SLS", inst = inst, 
+     data = Kmenta)

> round(coef(summary(fit2sls)), digits = 4)
                   Estimate Std. Error t value Pr(>|t|)
demand_(Intercept)  94.6333     7.9208 11.9474   0.0000
demand_price        -0.2436     0.0965 -2.5243   0.0218
demand_income        0.3140     0.0469  6.6887   0.0000
supply_(Intercept)  49.5324    12.0105  4.1241   0.0008
supply_price         0.2401     0.0999  2.4023   0.0288
supply_farmPrice     0.2556     0.0473  5.4096   0.0001
supply_trend         0.2529     0.0997  2.5380   0.0219

> fit3sls <- systemfit(system, method = "3SLS", inst = inst, 
+     data = Kmenta)

> round(coef(summary(fit3sls)), digits = 4)
                   Estimate Std. Error t value Pr(>|t|)
demand_(Intercept)  94.6333     7.9208 11.9474   0.0000
demand_price        -0.2436     0.0965 -2.5243   0.0218
demand_income        0.3140     0.0469  6.6887   0.0000
supply_(Intercept)  52.1972    11.8934  4.3888   0.0005
supply_price         0.2286     0.0997  2.2934   0.0357
supply_farmPrice     0.2282     0.0440  5.1861   0.0001
supply_trend         0.3611     0.0729  4.9546   0.0001

> fitI3sls <- systemfit(system, method = "3SLS", inst = inst, 
+     data = Kmenta, maxit = 250)

> round(coef(summary(fitI3sls)), digits = 4)
                   Estimate Std. Error t value Pr(>|t|)
demand_(Intercept)  94.6333     7.9208 11.9474   0.0000
demand_price        -0.2436     0.0965 -2.5243   0.0218
demand_income        0.3140     0.0469  6.6887   0.0000
supply_(Intercept)  52.6618    12.8051  4.1126   0.0008
supply_price         0.2266     0.1075  2.1086   0.0511
supply_farmPrice     0.2234     0.0468  4.7756   0.0002
supply_trend         0.3800     0.0720  5.2771   0.0001

> data("KleinI")

> eqConsump <- consump ~ corpProf + corpProfLag + wages

> eqInvest <- invest ~ corpProf + corpProfLag + capitalLag

> eqPrivWage <- privWage ~ gnp + gnpLag + trend

> inst <- ~govExp + taxes + govWage + trend + capitalLag + 
+     corpProfLag + gnpLag

> system <- list(Consumption = eqConsump, Investment = eqInvest, 
+     PrivateWages = eqPrivWage)

> kleinOls <- systemfit(system, data = KleinI)

> round(coef(summary(kleinOls)), digits = 3)
                         Estimate Std. Error t value Pr(>|t|)
Consumption_(Intercept)    16.237      1.303  12.464    0.000
Consumption_corpProf        0.193      0.091   2.115    0.049
Consumption_corpProfLag     0.090      0.091   0.992    0.335
Consumption_wages           0.796      0.040  19.933    0.000
Investment_(Intercept)     10.126      5.466   1.853    0.081
Investment_corpProf         0.480      0.097   4.939    0.000
Investment_corpProfLag      0.333      0.101   3.302    0.004
Investment_capitalLag      -0.112      0.027  -4.183    0.001
PrivateWages_(Intercept)    1.497      1.270   1.179    0.255
PrivateWages_gnp            0.439      0.032  13.561    0.000
PrivateWages_gnpLag         0.146      0.037   3.904    0.001
PrivateWages_trend          0.130      0.032   4.082    0.001

> klein2sls <- systemfit(system, method = "2SLS", inst = inst, 
+     data = KleinI, methodResidCov = "noDfCor")

> round(coef(summary(klein2sls)), digits = 3)
                         Estimate Std. Error t value Pr(>|t|)
Consumption_(Intercept)    16.555      1.321  12.534    0.000
Consumption_corpProf        0.017      0.118   0.147    0.885
Consumption_corpProfLag     0.216      0.107   2.016    0.060
Consumption_wages           0.810      0.040  20.129    0.000
Investment_(Intercept)     20.278      7.543   2.688    0.016
Investment_corpProf         0.150      0.173   0.867    0.398
Investment_corpProfLag      0.616      0.163   3.784    0.001
Investment_capitalLag      -0.158      0.036  -4.368    0.000
PrivateWages_(Intercept)    1.500      1.148   1.307    0.209
PrivateWages_gnp            0.439      0.036  12.316    0.000
PrivateWages_gnpLag         0.147      0.039   3.777    0.002
PrivateWages_trend          0.130      0.029   4.475    0.000

> klein3sls <- systemfit(system, method = "3SLS", inst = inst, 
+     data = KleinI, methodResidCov = "noDfCor")

> round(coef(summary(klein3sls)), digits = 3)
                         Estimate Std. Error t value Pr(>|t|)
Consumption_(Intercept)    16.441      1.305  12.603    0.000
Consumption_corpProf        0.125      0.108   1.155    0.264
Consumption_corpProfLag     0.163      0.100   1.624    0.123
Consumption_wages           0.790      0.038  20.826    0.000
Investment_(Intercept)     28.178      6.794   4.148    0.001
Investment_corpProf        -0.013      0.162  -0.081    0.937
Investment_corpProfLag      0.756      0.153   4.942    0.000
Investment_capitalLag      -0.195      0.033  -5.990    0.000
PrivateWages_(Intercept)    1.797      1.116   1.611    0.126
PrivateWages_gnp            0.400      0.032  12.589    0.000
PrivateWages_gnpLag         0.181      0.034   5.307    0.000
PrivateWages_trend          0.150      0.028   5.358    0.000

> kleinI3sls <- systemfit(system, method = "3SLS", inst = inst, 
+     data = KleinI, methodResidCov = "noDfCor", maxit = 500)

> round(coef(summary(kleinI3sls)), digits = 3)
                         Estimate Std. Error t value Pr(>|t|)
Consumption_(Intercept)    16.559      1.224  13.524    0.000
Consumption_corpProf        0.165      0.096   1.710    0.105
Consumption_corpProfLag     0.177      0.090   1.960    0.067
Consumption_wages           0.766      0.035  22.031    0.000
Investment_(Intercept)     42.896     10.594   4.049    0.001
Investment_corpProf        -0.357      0.260  -1.370    0.188
Investment_corpProfLag      1.011      0.249   4.065    0.001
Investment_capitalLag      -0.260      0.051  -5.115    0.000
PrivateWages_(Intercept)    2.625      1.196   2.195    0.042
PrivateWages_gnp            0.375      0.031  12.050    0.000
PrivateWages_gnpLag         0.194      0.032   5.977    0.000
PrivateWages_trend          0.168      0.029   5.805    0.000

> data("GrunfeldGreene")

> library("plm")

> GGPanel <- pdata.frame(GrunfeldGreene, c("firm", "year"))

> formulaGrunfeld <- invest ~ value + capital

> greeneOls <- systemfit(formulaGrunfeld, data = GGPanel)

> round(coef(summary(greeneOls)), digits = 4)
                              Estimate Std. Error t value Pr(>|t|)
Chrysler_(Intercept)           -6.1900    13.5065 -0.4583   0.6525
Chrysler_value                  0.0779     0.0200  3.9026   0.0011
Chrysler_capital                0.3157     0.0288 10.9574   0.0000
General.Electric_(Intercept)   -9.9563    31.3742 -0.3173   0.7548
General.Electric_value          0.0266     0.0156  1.7057   0.1063
General.Electric_capital        0.1517     0.0257  5.9015   0.0000
General.Motors_(Intercept)   -149.7825   105.8421 -1.4151   0.1751
General.Motors_value            0.1193     0.0258  4.6172   0.0002
General.Motors_capital          0.3714     0.0371 10.0193   0.0000
US.Steel_(Intercept)          -30.3685   157.0477 -0.1934   0.8490
US.Steel_value                  0.1566     0.0789  1.9848   0.0635
US.Steel_capital                0.4239     0.1552  2.7308   0.0142
Westinghouse_(Intercept)       -0.5094     8.0153 -0.0636   0.9501
Westinghouse_value              0.0529     0.0157  3.3677   0.0037
Westinghouse_capital            0.0924     0.0561  1.6472   0.1179

> round(sapply(greeneOls$eq, function(x) {
+     return(summary(x)$ssr/20)
+ }), digits = 3)
[1]  149.872  660.829 7160.294 8896.416   88.662

> greeneOlsPooled <- systemfit(formulaGrunfeld, data = GGPanel, 
+     pooled = TRUE)

> round(coef(summary(greeneOlsPooled$eq[[1]])), digits = 4)
            Estimate Std. Error t value Pr(>|t|)
(Intercept) -48.0297    21.4802 -2.2360   0.0276
value         0.1051     0.0114  9.2360   0.0000
capital       0.3054     0.0435  7.0186   0.0000

> sum(sapply(greeneOlsPooled$eq, function(x) {
+     return(summary(x)$ssr)
+ }))/100
[1] 15708.84

> greeneSur <- systemfit(formulaGrunfeld, method = "SUR", 
+     data = GGPanel, methodResidCov = "noDfCor")

> round(coef(summary(greeneSur)), digits = 4)
                              Estimate Std. Error t value Pr(>|t|)
Chrysler_(Intercept)            0.5043    11.5128  0.0438   0.9656
Chrysler_value                  0.0695     0.0169  4.1157   0.0007
Chrysler_capital                0.3085     0.0259 11.9297   0.0000
General.Electric_(Intercept)  -22.4389    25.5186 -0.8793   0.3915
General.Electric_value          0.0373     0.0123  3.0409   0.0074
General.Electric_capital        0.1308     0.0220  5.9313   0.0000
General.Motors_(Intercept)   -162.3641    89.4592 -1.8150   0.0872
General.Motors_value            0.1205     0.0216  5.5709   0.0000
General.Motors_capital          0.3827     0.0328 11.6805   0.0000
US.Steel_(Intercept)           85.4233   111.8774  0.7635   0.4556
US.Steel_value                  0.1015     0.0548  1.8523   0.0814
US.Steel_capital                0.4000     0.1278  3.1300   0.0061
Westinghouse_(Intercept)        1.0889     6.2588  0.1740   0.8639
Westinghouse_value              0.0570     0.0114  5.0174   0.0001
Westinghouse_capital            0.0415     0.0412  1.0074   0.3279

> round(greeneSur$residCov, digits = 3)
                 Chrysler General.Electric General.Motors  US.Steel
Chrysler          152.849            2.047       -313.704   455.089
General.Electric    2.047          700.456        605.336  1224.405
General.Motors   -313.704          605.336       7216.044 -2686.517
US.Steel          455.089         1224.405      -2686.517  9188.151
Westinghouse       16.661          200.316        129.887   652.716
                 Westinghouse
Chrysler               16.661
General.Electric      200.316
General.Motors        129.887
US.Steel              652.716
Westinghouse           94.912

> round(summary(greeneSur)$residCor, digits = 3)
                 Chrysler General.Electric General.Motors US.Steel Westinghouse
Chrysler            1.000            0.006         -0.299    0.384        0.138
General.Electric    0.006            1.000          0.269    0.483        0.777
General.Motors     -0.299            0.269          1.000   -0.330        0.157
US.Steel            0.384            0.483         -0.330    1.000        0.699
Westinghouse        0.138            0.777          0.157    0.699        1.000

> greeneSurPooled <- systemfit(formulaGrunfeld, method = "SUR", 
+     data = GGPanel, pooled = TRUE, methodResidCov = "noDfCor", 
+     residCovWeigh .... [TRUNCATED] 

> round(coef(summary(greeneSurPooled$eq[[1]])), digits = 4)
            Estimate Std. Error t value Pr(>|t|)
(Intercept) -28.2467     4.8882 -5.7785        0
value         0.0891     0.0051 17.5663        0
capital       0.3340     0.0167 19.9859        0

> round(greeneSurPooled$residCov, digits = 3)
                  Chrysler General.Electric General.Motors   US.Steel
Chrysler           305.610        -1966.648         -4.805   2158.595
General.Electric -1966.648        34556.603      -7160.667 -28722.006
General.Motors      -4.805        -7160.667      10050.525   4439.989
US.Steel          2158.595       -28722.006       4439.989  34468.976
Westinghouse      -123.920         4274.000      -1400.747  -2893.733
                 Westinghouse
Chrysler             -123.920
General.Electric     4274.000
General.Motors      -1400.747
US.Steel            -2893.733
Westinghouse          833.357

> round(cov(residuals(greeneSurPooled)), digits = 3)
                 Chrysler General.Electric General.Motors  US.Steel
Chrysler          167.403          174.038       -432.370   260.431
General.Electric  174.038         3733.260      -1322.236  -972.145
General.Motors   -432.370        -1322.236       9396.058  -897.950
US.Steel          260.431         -972.145       -897.950 10052.045
Westinghouse       89.336         1302.231       -865.791  -180.385
                 Westinghouse
Chrysler               89.336
General.Electric     1302.231
General.Motors       -865.791
US.Steel             -180.385
Westinghouse          564.156

> round(summary(greeneSurPooled)$residCor, digits = 3)
                 Chrysler General.Electric General.Motors US.Steel Westinghouse
Chrysler            1.000            0.220         -0.345    0.201        0.291
General.Electric    0.220            1.000         -0.223   -0.159        0.897
General.Motors     -0.345           -0.223          1.000   -0.092       -0.376
US.Steel            0.201           -0.159         -0.092    1.000       -0.076
Westinghouse        0.291            0.897         -0.376   -0.076        1.000

> GrunfeldTheil <- subset(GrunfeldGreene, firm %in% 
+     c("General Electric", "Westinghouse"))

> GTPanel <- pdata.frame(GrunfeldTheil, c("firm", "year"))

> formulaGrunfeld <- invest ~ value + capital

> theilOls <- systemfit(formulaGrunfeld, data = GTPanel)

> round(coef(summary(theilOls)), digits = 3)
                             Estimate Std. Error t value Pr(>|t|)
General.Electric_(Intercept)   -9.956     31.374  -0.317    0.755
General.Electric_value          0.027      0.016   1.706    0.106
General.Electric_capital        0.152      0.026   5.902    0.000
Westinghouse_(Intercept)       -0.509      8.015  -0.064    0.950
Westinghouse_value              0.053      0.016   3.368    0.004
Westinghouse_capital            0.092      0.056   1.647    0.118

> theilSur <- systemfit(formulaGrunfeld, method = "SUR", 
+     data = GTPanel, methodResidCov = "noDfCor")

> round(coef(summary(theilSur)), digits = 3)
                             Estimate Std. Error t value Pr(>|t|)
General.Electric_(Intercept)  -27.719     27.033  -1.025    0.320
General.Electric_value          0.038      0.013   2.883    0.010
General.Electric_capital        0.139      0.023   6.036    0.000
Westinghouse_(Intercept)       -1.252      6.956  -0.180    0.859
Westinghouse_value              0.058      0.013   4.297    0.000
Westinghouse_capital            0.064      0.049   1.308    0.208

> RMatrix <- rbind(c(0, 1, 0, 0, -1, 0), c(0, 0, 1, 
+     0, 0, -1))

> linearHypothesis(theilSur, RMatrix)
Linear hypothesis test (Theil's F test)

Hypothesis:
General.Electric_value - Westinghouse_value = 0
General.Electric_capital - Westinghouse_capital = 0

Model 1: restricted model
Model 2: theilSur

  Res.Df Df      F Pr(>F)
1     36                 
2     34  2 2.0583 0.1433

> theilSurRestr <- systemfit(formulaGrunfeld, method = "SUR", 
+     data = GTPanel, methodResidCov = "noDfCor", restrict.matrix = RMatrix, 
+     res .... [TRUNCATED] 

> round(coef(summary(theilSurRestr)), digits = 3)
                             Estimate Std. Error t value Pr(>|t|)
General.Electric_(Intercept)  -23.032     17.998  -1.280    0.209
General.Electric_value          0.036      0.008   4.779    0.000
General.Electric_capital        0.139      0.023   6.079    0.000
Westinghouse_(Intercept)        6.900      5.767   1.196    0.239
Westinghouse_value              0.036      0.008   4.779    0.000
Westinghouse_capital            0.139      0.023   6.079    0.000

> library("systemfit")

> set.seed(1)

> systemfitModel <- createSystemfitModel(nEq = 8, nReg = 10, 
+     nObs = 750)

> system.time(fitMatrix <- systemfit(systemfitModel$formula, 
+     method = "SUR", data = systemfitModel$data))
   user  system elapsed 
   0.47    0.10    0.56 

> system.time(fitTrad <- systemfit(systemfitModel$formula, 
+     method = "SUR", data = systemfitModel$data, useMatrix = FALSE))
   user  system elapsed 
   1.25    0.15    1.40 

> all.equal(fitMatrix, fitTrad)
[1] "Component \"call\": target, current do not match when deparsed"    
[2] "Component \"control\": Component \"useMatrix\": 1 element mismatch"

> smallModel <- createSystemfitModel(nEq = 3, nReg = 4, 
+     nObs = 50)

> system.time(fitSmallMatrix <- systemfit(smallModel$formula, 
+     method = "SUR", data = smallModel$data, maxit = 500))
   user  system elapsed 
   0.25    0.00    0.25 

> system.time(fitSmallTrad <- systemfit(smallModel$formula, 
+     method = "SUR", data = smallModel$data, maxit = 500, useMatrix = FALSE))
   user  system elapsed 
   0.02    0.00    0.01 

> all.equal(fitSmallMatrix, fitSmallTrad)
[1] "Component \"call\": target, current do not match when deparsed"    
[2] "Component \"control\": Component \"useMatrix\": 1 element mismatch"

> options(width = 75)

> library("sem")

  When sourcing 'systemfit.R':
Error: there is no package called 'sem'
Execution halted

  'systemfit.Rnw' using 'UTF-8'... failed