Simultaneous Equation Estimation Package

Simultaneous Equation Estimation Package [R logo]

Help pages for package `systemfit' version 0.8-0

coef.summary.systemfit | Coefficients of systemfit object
coef.systemfit | Coefficients of systemfit object
confint.systemfit | Confidence intervals of coefficients
correlation.systemfit | Correlation between Predictions from Equation i and j
fitted.systemfit | Fitted values
ftest.systemfit | F-test for Equation Systems
GrunfeldGreene | Grunfeld Data as published by Greene (2003)
GrunfeldTheil | Grunfeld Data as published in Theil (1971)
hausman.systemfit | Hausman Test
KleinI | Klein Model I
Kmenta | Partly Artificial Data on the U. S. Economy
lrtest.systemfit | Likelihood Ratio test for Equation Systems
nlsystemfit | Nonlinear Equation System Estimation
ppine | Tree Growth Data for Ponderosa Pine
predict.systemfit | Predictions from System Estimation
print.confint.systemfit | Print confidence intervals of coefficients
print.ftest.systemfit | F-test for Equation Systems
print.lrtest.systemfit | Likelihood Ratio test for Equation Systems
print.nlsystemfit.equation | Print output of nlsystemfit estimation
print.nlsystemfit.system | Print output of nlsystemfit estimation
print.summary.systemfit | Summary of systemfit estimation
print.systemfit | Print results of systemfit estimation
print.waldtest.systemfit | Wald-test for Equation Systems
residuals.systemfit | Residuals of systemfit object
se.ratio.systemfit | Ratio of the Standard Errors
summary.nlsystemfit.equation | Summary of nlsystemfit estimation
summary.nlsystemfit.system | Summary of nlsystemfit estimation
summary.systemfit | Summary of systemfit estimation
systemfit | Linear Equation System Estimation
systemfitClassic | Linear Equation System Estimation
vcov.systemfit | Variance covariance matrix of coefficients
waldtest.systemfit | Wald-test for Equation Systems


Coefficients of systemfit object

Description

These functions extract the coefficients from an object returned by systemfit.

Usage

   ## S3 method for class 'systemfit':
   coef( object, ... )

   ## S3 method for class 'systemfit.equation':
   coef( object, ... )

   ## S3 method for class 'summary.systemfit':
   coef( object, ... )

   ## S3 method for class 'summary.systemfit.equation':
   coef( object, ... )

Arguments

object | an object of class systemfit, systemfit.equation, summary.systemfit, or summary.systemfit.equation.
... | other arguments.

Value

coef.systemfit returns a vector of all estimated coefficients.
coef.systemfit.equation returns a vector of the estimated coefficients of a single equation.
coef.summary.systemfit returns a matrix of all estimated coefficients, their standard errors, t-values, and p-values.
coef.summary.systemfit.equation returns a matrix of the estimated coefficients of a single equation, their standard errors, t-values, and p-values.

Author(s)

Arne Henningsen ahenningsen@agric-econ.uni-kiel.de

See Also

systemfit, coef

Examples

data( "Kmenta" )
demand <- consump ~ price + income
supply <- consump ~ price + farmPrice + trend
labels <- list( "demand", "supply" )
system <- list( demand, supply )

## perform OLS on each of the equations in the system
fitols <- systemfit( "OLS", system, labels, data = Kmenta )

## all coefficients
coef( fitols )
coef( summary( fitols ) )

## coefficients of the first equation
coef( fitols$eq[[1]] )
coef( summary( fitols$eq[[1]] ) )

## coefficients of the second equation
coef( fitols$eq[[2]] )
coef( summary( fitols$eq[[2]] ) )
[Package systemfit version 0.8-0 Index]


Confidence intervals of coefficients

Description

These functions calculate the confidence intervals of the coefficients from an object returned by systemfit.

Usage

   ## S3 method for class 'systemfit':
   confint( object, parm = NULL, level = 0.95, ... )

   ## S3 method for class 'systemfit.equation':
   confint( object, parm, level = 0.95, ... )

Arguments

object | an object of class systemfit or systemfit.equation.
parm | not used yet.
level | confidence level.
... | other arguments.

Value

An object of class confint.systemfit, which is a matrix with columns giving lower and upper confidence limits for each estimated coefficient. These will be labelled as (1-level)/2 and 1 - (1-level)/2 in % (by default 2.5% and 97.5%).

Author(s)

Arne Henningsen ahenningsen@agric-econ.uni-kiel.de

See Also

systemfit, print.confint.systemfit, confint

Examples

data( "Kmenta" )
demand <- consump ~ price + income
supply <- consump ~ price + farmPrice + trend
labels <- list( "demand", "supply" )
system <- list( demand, supply )

## perform OLS on each of the equations in the system
fitols <- systemfit( "OLS", system, labels, data = Kmenta )

## confidence intervals of all coefficients
confint( fitols )

## confidence intervals of the coefficients of the first equation
confint( fitols$eq[[1]] )

## confidence intervals of the coefficients of the second equation
confint( fitols$eq[[2]] )


Correlation between Predictions from Equation i and j

Description

correlation returns a vector of the correlations between the preditions of two equations in a set of equations. The correlation between the predictions is defined as,

r_{ijk} = frac{x'_{ik}C_{ij}x_{jk}}{sqrt{(x'_{ik}C_{ii}x_{ik})(x'_{jk}C_{jj}x_{jk})}}

where r_{ijk} is the correlation between the predicted values of equation i and j and C_{ij} is the cross-equation variance-covariance matrix between equations i and j.

Usage

correlation.systemfit( results, eqni, eqnj )

Arguments

results | an object of type systemfit.
eqni | index for equation i
eqnj | index for equation j

Value

correlation returns a vector of the correlations between the predicted values in equation i and equation j.

Author(s)

Jeff D. Hamann jeff.hamann@forestinformatics.com

References

Greene, W. H. (1993) Econometric Analysis, Second Edition, Macmillan.

Hasenauer, H; Monserud, R and T. Gregoire. (1998) Using Simultansous Regression Techniques with Individual-Tree Growth Models. Forest Science. 44(1):87-95

Kmenta, J. (1997) Elements of Econometrics, Second Edition, University of Michigan Publishing

See Also

systemfit

Examples

data( "Kmenta" )
demand <- consump ~ price + income
supply <- consump ~ price + farmPrice + trend
inst <- ~ income + farmPrice + trend
labels <- list( "demand", "supply" )
system <- list( demand, supply )

## perform 2SLS on each of the equations in the system
fit2sls <- systemfit( "2SLS", system, labels, inst, data = Kmenta )
print( fit2sls )
print( fit2sls$rcov )

## perform the 3SLS
fit3sls <- systemfit( "3SLS", system, labels, inst, data = Kmenta )
print( fit3sls )
print( "covariance of residuals used for estimation (from 2sls)" )
print( fit3sls$rcovest )
print( "covariance of residuals" )
print( fit3sls$rcov )

## examine the correlation between the predicted values
## of suppy and demand by plotting the correlation over
## the value of q
r12 <- correlation.systemfit( fit3sls, 1, 2 )
plot( Kmenta$consump, r12, main="correlation between predictions from supply and demand" )


Fitted values

Description

These functions extract the fitted values from an object returned by systemfit.

Usage

   ## S3 method for class 'systemfit':
   fitted( object, ... )

   ## S3 method for class 'systemfit.equation':
   fitted( object, ... )

Arguments

object | an object of class systemfit or systemfit.equation.
... | other arguments.

Value

fitted.systemfit returns a vector of all fitted values.
fitted.systemfit.equation returns a vector of the fitted values of a single equation.

Author(s)

Arne Henningsen ahenningsen@agric-econ.uni-kiel.de

See Also

systemfit, fitted

Examples

data( "Kmenta" )
demand <- consump ~ price + income
supply <- consump ~ price + farmPrice + trend
labels <- list( "demand", "supply" )
system <- list( demand, supply )

## perform OLS on each of the equations in the system
fitols <- systemfit( "OLS", system, labels, data = Kmenta )

## all fitted values
fitted( fitols )

## fitted values of the first equation
fitted( fitols$eq[[1]] )

## fitted values of the second equation
fitted( fitols$eq[[2]] )


F-test for Equation Systems

Description

F-test for linear parameter restrictions in equation systems.

Usage

   ftest.systemfit( object, R.restr,
      q.restr = rep( 0, nrow( R.restr ) ) )

   ## S3 method for class 'ftest.systemfit':
   print( x, digits = 4, ... )

Arguments

object | an object of type systemfit.
R.restr | j x k matrix to impose linear restrictions on the parameters by R.restr * b = q.restr (j = number of restrictions, k = number of all parameters, b = vector of all parameters).
q.restr | an optional vector with j elements to impose linear restrictions (see R.restr); default is a vector that contains only zeros.
x | an object of class ftest.systemfit.
digits | number of digits to print.
... | currently not used.

Details

The F-statistic for sytems of equations is

F = frac{ ( R hat{b} - q )' ( R ( X' ( hat{Σ} otimes I )^{-1} X )^{-1} R' )^{-1} ( R hat{b} - q ) / j }{ hat{e}' ( Σ otimes I )^{-1} hat{e} / ( M cdot T - K ) }

where j is the number of restrictions, M is the number of equations, T is the number of observations per equation, K is the total number of estimated coefficients, and Σ is the residual covariance matrix used in the estimation. Under the null hypothesis, F has an F-distribution with j and M cdot T - K degrees of freedom (Theil, 1971, p. 314).

Value

ftest.systemfit returns a list of class ftest.systemfit that includes following objects:

statistic | the empirical F statistic.
p.value | the p-value of the F-test.
nRestr | number of restrictions (j, degrees of freedom of the numerator).
dfSys | degrees of freedom of the equation system (M cdot T - K, degrees of freedom of the denominator).

Author(s)

Arne Henningsen ahenningsen@agric-econ.uni-kiel.de

References

Theil, Henri (1971). Principles of Econometrics, John Wiley & Sons, New York.

See Also

systemfit, waldtest.systemfit, lrtest.systemfit

Examples

data( "Kmenta" )
eqDemand <- consump ~ price + income
eqSupply <- consump ~ price + farmPrice + trend
system <- list( demand = eqDemand, supply = eqSupply )

## unconstrained SUR estimation
fitsur <- systemfit( "SUR", system, data=Kmenta )

# create restriction matrix to test whether \eqn{beta_2 = \beta_6}
R1 <- matrix( 0, nrow = 1, ncol = 7 )
R1[ 1, 2 ] <- 1
R1[ 1, 6 ] <- -1

## perform F-test
fTest1 <- ftest.systemfit( fitsur, R1 )
print( fTest1 )   # rejected

# create restriction matrix to test whether \eqn{beta_2 = - \beta_6}
R2 <- matrix( 0, nrow = 1, ncol = 7 )
R2[ 1, 2 ] <- 1
R2[ 1, 6 ] <- 1

## perform F-test
fTest2 <- ftest.systemfit( fitsur, R2 )
print( fTest2 )   # accepted


Grunfeld Data as published by Greene (2003)

Description

Panel data on 5 US firms for the years 1935-1954.

Usage

   data("GrunfeldGreene")

Format

A data frame containing 20 annual observations on 3 variables for 5 firms.

invest
gross investment.
value
market value of the firm (at the end of the previous year).
capital
capital stock of the firm (at the end of the previous year).
firm
name of the firm ("General Motors", "Chrysler", "General Electric", "Westinghouse" or "US Steel").
year
year.

Details

There exist several different versions of this data set, and this version is considered incorrect (see http://www.stanford.edu/~clint/bench/grunfeld.htm for details). However, we provide this incorrect version to replicated the results published in Greene (2003).

Source

Greene (2003), Appendix F, Data Sets Used in Applications, Table F13.1.

http://pages.stern.nyu.edu/~wgreene/Text/econometricanalysis.htm

References

Greene, W.H. (2003). Econometric Analysis, 5th edition. Prentice Hall, Upper Saddle River (NJ).

Grunfeld, Y. (1958). The Determinants of Corporate Investment, Unpublished Ph.D. Dissertation, University of Chicago.

Examples

## Repeating the OLS and SUR estimations in Greene (2003, pp. 351)
data( "GrunfeldGreene" )
formulaGrunfeld <- invest ~ value + capital
# OLS
greeneOls <- systemfitClassic( "OLS", formulaGrunfeld, "firm", "year",
   data = GrunfeldGreene )
summary( greeneOls )
sapply( greeneOls$eq, function(x){return(x$ssr/20)} ) # sigma^2
# OLS Pooled
greeneOlsPooled <- systemfitClassic( "OLS", formulaGrunfeld, "firm", "year",
   data = GrunfeldGreene, pooled = TRUE )
summary( greeneOlsPooled )
sum( sapply( greeneOlsPooled$eq, function(x){return(x$ssr)}) )/97 # sigma^2
# SUR
greeneSur <- systemfitClassic( "SUR", formulaGrunfeld, "firm", "year",
   data = GrunfeldGreene, rcovformula = 0 )
summary( greeneSur )
# SUR Pooled
greeneSurPooled <- systemfitClassic( "WSUR", formulaGrunfeld, "firm", "year",
   data = GrunfeldGreene, pooled = TRUE, rcovformula = 0 )
summary( greeneSurPooled )


Grunfeld Data as published in Theil (1971)

Description

Panel data on 2 US firms for the years 1935-1954.

Usage

   data("GrunfeldTheil")

Format

A data frame containing 20 annual observations on 3 variables for 2 firms.

invest
gross investment.
value
market value of the firm (at the end of the previous year).
capital
capital stock of the firm (at the end of the previous year).
firm
name of the firm ("General Electric" or "Westinghouse").
year
year.

Source

Theil (1971), p. 296.

References

Grunfeld, Y. (1958). The Determinants of Corporate Investment, Unpublished Ph.D. Dissertation, University of Chicago.

Theil, Henri (1971). Principles of Econometrics, John Wiley & Sons, New York.

Examples

## Repeating the OLS and SUR estimations in Theil (1971, pp. 295, 300)
data( "GrunfeldTheil" )
formulaGrunfeld <- invest ~ value + capital
# OLS
theilOls <- systemfitClassic( "OLS", formulaGrunfeld, "firm", "year",
   data = GrunfeldTheil )
summary( theilOls )
# SUR
theilSur <- systemfitClassic( "SUR", formulaGrunfeld, "firm", "year",
   data = GrunfeldTheil, rcovformula = 0 )
summary( theilSur )


Hausman Test

Description

hausman.systemfit returns the Hausman statistic for a specification test.

Usage

   hausman.systemfit( results2sls, results3sls )

Arguments

results2sls | result of a 2SLS (limited information) estimation returned by systemfit.
results3sls | result of a 3SLS (full information) estimation returned by systemfit.

Details

The null hypotheses of the test is that all exogenous variables are uncorrelated with all disturbance terms. Under this hypothesis both the 2SLS and the 3SLS estimator are consistent but only the 3SLS estimator is (asymptotically) efficient. Under the alternative hypothesis the 2SLS estimator is consistent but the 3SLS estimator is inconsistent.

The Hausman test statistic is

m = ( b_2 - b_3 )' ( V_2 - V_3 ) ( b_2 - b_3 )

where $b_2$ and $V_2$ are the estimated coefficients and their variance covariance matrix of a 2SLS estimation and $b_3$ and $V_3$ are the estimated coefficients and their variance covariance matrix of a 3SLS estimation.

Value

hausman.systemfit returns a list of the class htest that contains following elements:

q | vector of the differences between the estimated coefficients.
qVar | variance covariance matrix of q (difference between the variance covariance matrices of the estimated coefficients).
statistic | the Hausman test statistic.
parameter | degrees of freedom.
p.value | P-value of the test.
method | character string describing this test.
data.name | name of the data.frame used for estimation.

Author(s)

Jeff D. Hamann jeff.hamann@forestinformatics.com,
Arne Henningsen ahenningsen@agric-econ.uni-kiel.de

References

Greene, W. H. (1993) Econometric Analysis, Fifth Edition, Macmillan.

Hausman, J. A. (1978) Specification Tests in Econometrics. Econometrica. 46:1251-1271.

Kmenta, J. (1997) Elements of Econometrics, Second Edition, University of Michigan Publishing

See Also

systemfit

Examples

data( "Kmenta" )
demand <- consump ~ price + income
supply <- consump ~ price + farmPrice + trend
inst <- ~ income + farmPrice + trend
labels <- list( "demand", "supply" )
system <- list( demand, supply )

## perform the estimations
fit2sls <- systemfit( "2SLS", system, labels, inst, data = Kmenta )
fit3sls <- systemfit( "3SLS", system, labels, inst, data = Kmenta )

## perform the Hausman test
h <- hausman.systemfit( fit2sls, fit3sls )
print( h )


Klein Model I

Description

Data for Klein's (1950) Model I of the US economy.

Usage

data("KleinI")

Format

A data frame containing annual observations from 1920 to 1941

year
Year.
consump
Consumption.
corpProf
Corporate profits.
corpProfLag
Corporate profits of the previous year.
privWage
Private wage bill.
invest
Investment.
capitalLag
Capital stock of the previous year.
gnp
Gross national product.
gnpLag
Gross national product of the previous year.
govWage
Government wage bill.
govExp
Government spending.
taxes
Taxes.
wages
Sum of private and government wage bill.
trend
time trend measured as years from 1931.

Source

Greene (2003), Appendix F, Data Sets Used in Applications, Table F15.1.

http://pages.stern.nyu.edu/~wgreene/Text/econometricanalysis.htm

References

Greene, W.H. (2003). Econometric Analysis, 5th edition. Prentice Hall, Upper Saddle River (NJ).

Klein, L. (1950). Economic Fluctuations in the United States, 1921–1941. John Wiley, New York.

Examples

## Repeating the estimations of Klein's (1950) Model I
## in Greene (2003, pp. 381 and 412)
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,
   "Private Wages" = eqPrivWage )
# OLS
kleinOls <- systemfit( "OLS", system, data = KleinI )
summary( kleinOls )
# 2SLS
klein2sls <- systemfit( "2SLS", system, inst = inst, data = KleinI,
   rcovformula = 0 )
summary( klein2sls )
# 3SLS
klein3sls <- systemfit( "3SLS", system, inst = inst, data = KleinI,
   rcovformula = 0 )
summary( klein3sls )
# I3SLS
kleinI3sls <- systemfit( "3SLS", system, inst = inst, data = KleinI,
   rcovformula = 0, maxit = 500 )
summary( kleinI3sls )


Partly Artificial Data on the U. S. Economy

Description

These are partly contrived data from Kmenta (1986), constructed to illustrate estimation of a simultaneous-equation model.

Usage

   data("Kmenta")

Format

This data frame contains 20 annual observations of 5 variables:

consump
food consumption per capita.
price
ratio of food prices to general consumer prices.
income
disposable income in constant dollars.
farmPrice
ratio of preceding year's prices received by farmers to general consumer prices.
trend
time trend in years.

Details

The exogenous variables income, farmPrice, and trend are based on real data; the endogenous variables price and consump were generated by simulation.

Source

Kmenta (1986), Table 13-1, p. 687.

References

Kmenta, J. (1986). Elements of Econometrics, Second Edition, Macmillan, New York.

Examples

## Replicating the estimations in Kmenta (1986), p. 712, Tab 13-2
data( "Kmenta" )
eqDemand <- consump ~ price + income
eqSupply <- consump ~ price + farmPrice + trend
inst <- ~ income + farmPrice + trend
system <- list( demand = eqDemand, supply = eqSupply )

## OLS estimation
fitOls <- systemfit( "OLS", system, data = Kmenta )
summary( fitOls )

## 2SLS estimation
fit2sls <- systemfit( "2SLS", system, inst = inst, data = Kmenta )
summary( fit2sls )

## 3SLS estimation
fit3sls <- systemfit( "3SLS", system, inst = inst, data = Kmenta )
summary( fit3sls )

## I3LS estimation
fitI3sls <- systemfit( "3SLS", system, inst = inst, data = Kmenta,
   maxit = 250 )
summary( fitI3sls )


Likelihood Ratio test for Equation Systems

Description

Likelihood Ratio test for linear parameter restrictions in equation system.

Usage

   lrtest.systemfit( resultc, resultu )

   ## S3 method for class 'lrtest.systemfit':
   print( x, digits = 4, ... )

Arguments

resultc | an object of type systemfit that contains the results of the restricted estimation.
resultu | an object of type systemfit that contains the results of the unconstrained estimation.
x | an object of class ftest.systemfit.
digits | number of digits to print.
... | currently not used.

Details

The LR-statistic for sytems of equations is

LR = T cdot ( log <=ft| hat{ hat{ Σ } }_r right| - log <=ft| hat{ hat{ Σ } }_u right| )

where T is the number of observations per equation, and hat{hat{Σ}}_r and hat{hat{Σ}}_u are the residual covariance matrices calculated by formula "0" (see systemfit) of the restricted and unrestricted estimation, respectively. Asymptotically, LR has a chi^2 distribution with j degrees of freedom under the null hypothesis (Green, 2003, p. 349).

Value

lrtest.systemfit returns a list of class lrtest.systemfit that includes following objects:

statistic | the empirical likelihood ratio statistic.
p.value | the p-value of the chi^2-test.
nRestr | number of restrictions (j, degrees of freedom).

Author(s)

Arne Henningsen ahenningsen@agric-econ.uni-kiel.de

References

Greene, W. H. (2003) Econometric Analysis, Fifth Edition, Prentice Hall.

See Also

systemfit, ftest.systemfit, waldtest.systemfit

Examples

data( "Kmenta" )
eqDemand <- consump ~ price + income
eqSupply <- consump ~ price + farmPrice + trend
system <- list( demand = eqDemand, supply = eqSupply )

## unconstrained SUR estimation
fitsur <- systemfit( "SUR", system, data = Kmenta )

# create restriction matrix to impose \eqn{beta_2 = \beta_6}
R1 <- matrix( 0, nrow = 1, ncol = 7 )
R1[ 1, 2 ] <- 1
R1[ 1, 6 ] <- -1

## constrained SUR estimation
fitsur1 <- systemfit( "SUR", system, data = Kmenta, R.restr = R1 )

## perform LR-test
lrTest1 <- lrtest.systemfit( fitsur1, fitsur )
print( lrTest1 )   # rejected

# create restriction matrix to impose \eqn{beta_2 = - \beta_6}
R2 <- matrix( 0, nrow = 1, ncol = 7 )
R2[ 1, 2 ] <- 1
R2[ 1, 6 ] <- 1

## constrained SUR estimation
fitsur2 <- systemfit( "SUR", system, data = Kmenta, R.restr = R2 )

## perform LR-test
lrTest2 <- lrtest.systemfit( fitsur2, fitsur )
print( lrTest2 )   # accepted


Nonlinear Equation System Estimation

Description

Fits a set of structural nonlinear equations using Ordinary Least Squares (OLS), Seemingly Unrelated Regression (SUR), Two-Stage Least Squares (2SLS), Three-Stage Least Squares (3SLS).

Usage

 nlsystemfit( method="OLS", eqns, startvals,
                     eqnlabels=c(as.character(1:length(eqns))), inst=NULL,
                     data=list(), solvtol=.Machine$double.eps,
                     maxiter=1000, ... )

Arguments

method | the estimation method, one of "OLS", "SUR", "2SLS", "3SLS".
eqns | a list of structural equations to be estimated.
startvals | a list of starting parameter values for the minimization.
eqnlabels | an optional list of character vectors of names for the equation labels.
inst | one-sided model formula specifying instrumental variables or a list of one-sided model formulas if different instruments should be used for the different equations (only needed for 2SLS, 3SLS and GMM estimations).
data | an optional data frame containing the variables in the model. By default the variables are taken from the environment from which nlsystemfit is called.
solvtol | tolerance for detecting linear dependencies in the columns of X in the qr function calls.
maxiter | the maximum number of iterations for the nlm function.
... | arguments passed to nlm.

Details

The nlsystemfit function relies on nlm to perform the minimization of the objective functions and the qr set of functions.

A system of nonlinear equations can be written as:

ε_{t} = q( y_t, x_t, theta )

z_{t} = Z( x_t )

where ε_{t} are the residuals from the y observations and the function evaluated at the parameter estimates.

The objective functions for the methods are:

Method | Instruments | Objective Function | Covariance of theta
OLS | no | r'r | (X(diag(S)^{-1}bigotimes I)X)^{-1}
SUR | no | r'(diag(S)_{OLS}^{-1}bigotimes I)r | (X(S^{-1}bigotimes I)X)^{-1}
2SLS | yes | r'(I bigotimes W)r | (X(diag(S)^{-1}bigotimes I)X)^{-1}
3SLS | yes | r'(S_{2SLS}^{-1} bigotimes W)r | (X(diag(S)^{-1}bigotimes W)X)^{-1}

where, r is a column vector for the residuals for each equation, S is variance-covariance matrix between the equations (hat{σ}_{ij} = (hat{e}_i' hat{e}_j) / sqrt{(T - k_i)*(T - k_j)}), X is matrix of the partial derivates with respect to the parameters, W is a matrix of the instrument variables Z(Z'Z)^{-1}Z, Z is a matrix of the instrument variables, and I is an nxn identity matrix.

The SUR and 3SLS methods requires two solutions. The first solution for the SUR is an OLS solution to obtain the variance-covariance matrix. The 3SLS uses the variance-covatiance from a 2SLS solution, then fits all the equations simultaneously.

The user should be aware that the function is VERY sensative to the starting values and the nlm function may not converge. The nlm function will be called with the typsize argument set the absolute values of the starting values for the OLS and 2SLS methods. For the SUR and 3SLS methods, the typsize argument is set to the absolute values of the resulting OLS and 2SLS parameter estimates from the nlm result structre. In addition, the starting values for the SUR and 3SLS methods are obtained from the OLS and 2SLS parameter estimates to shorten the number of iterations. The number of iterations reported in the summary are only those used in the last call to nlm, thus the number of iterations in the OLS portion of the SUR fit and the 2SLS portion of the 3SLS fit are not included.

Value

nlsystemfit returns a list of the class nlsystemfit.system and contains all results that belong to the whole system. This list contains one special object: "eq". It is a list and contains one object for each estimated equation. These objects are of the class nlsystemfit.equation and contain the results that belong only to the regarding equation.
The objects of the class nlsystemfit.system and nlsystemfit.equation have the following components (the elements of the latter are marked with an asterisk (*)):

eq | a list object that contains a list object for each equation.
method | estimation method.
resids | an n times g matrix of the residuals.
g | number of equations.
n | total number of observations.
k | total number of coefficients.
b | vector of all estimated coefficients.
se | estimated standard errors of b.
t | t values for b.
p | p values for b.
bcov | estimated covariance matrix of b.
rcov | estimated residual covariance matrix.
drcov | determinant of rcov.
rcovest | residual covariance matrix used for estimation (only SUR and 3SLS).
rcor | estimated residual correlation matrix.
nlmest | results from the nlm function call
solvetol | tolerance level when inverting a matrix or calculating a determinant.
eq | a list that contains the results that belong to the individual equations.
eqnlabel* | the equation label of the ith equation (from the labels list).
formula* | model formula of the ith equation.
n* | number of observations of the ith equation.
k* | number of coefficients/regressors in the ith equation.
df* | degrees of freedom of the ith equation.
b* | estimated coefficients of the ith equation.
se* | estimated standard errors of b.
t* | t values for b.
p* | p values for b.
covb* | estimated covariance matrix of b.
predicted* | vector of predicted values of the ith equation.
residuals* | vector of residuals of the ith equation.
ssr* | sum of squared residuals of the ith equation.
mse* | estimated variance of the residuals (mean of squared errors) of the ith equation.
s2* | estimated variance of the residuals (hat{σ}^2) of the ith equation.
rmse* | estimated standard error of the residulas (square root of mse) of the ith equation.
s* | estimated standard error of the residuals (hat{σ}) of the ith equation.
r2* | R-squared (coefficient of determination).
adjr2* | adjusted R-squared value.

Author(s)

Jeff D. Hamann jeff.hamann@forestinformatics.com

References

Gallant, R. H. (1987) Nonlinear Equation Estimation, John Wiley and Sons, 610 pp.

SAS Institute (1999) SAS/ETS User's Guide, Version 8, Cary NC: SAS Institute 1546 pp.

See Also

systemfit, nlm, and qr

Examples

library( systemfit )
data( ppine )

hg.formula <- hg ~ exp( h0 + h1*log(tht) + h2*tht^2 + h3*elev + h4*cr)
dg.formula <- dg ~ exp( d0 + d1*log(dbh) + d2*hg + d3*cr + d4*ba  )
labels <- list( "height.growth", "diameter.growth" )
inst <- ~ tht + dbh + elev + cr + ba
start.values <- c(h0=-0.5, h1=0.5, h2=-0.001, h3=0.0001, h4=0.08,
                  d0=-0.5, d1=0.009, d2=0.25, d3=0.005, d4=-0.02 )
model <- list( hg.formula, dg.formula )

model.ols <- nlsystemfit( "OLS", model, start.values, data=ppine, eqnlabels=labels )
print( model.ols )

model.sur <- nlsystemfit( "SUR", model, start.values, data=ppine, eqnlabels=labels )
print( model.sur )

model.2sls <- nlsystemfit( "2SLS", model, start.values, data=ppine,
   eqnlabels=labels, inst=inst )
print( model.2sls )

model.3sls <- nlsystemfit( "3SLS", model, start.values, data=ppine,
                                    eqnlabels=labels, inst=inst )
print( model.3sls )


Tree Growth Data for Ponderosa Pine

Description

A subset of tree growth observations from a Ponderosa pine growth database.

The ppine data frame has 166 rows and 8 columns.

Usage

data(ppine)

Format

This data frame contains the following columns:

elev
Altitude of the plot, in feet above mean sea level.
smi
Summer moisture index is the ratio of growing season heating degree days to growing season precipitation.
dbh
Diameter of the tree at breast height (4.5 feet).
tht
Total stem height for the tree.
cr
Crown ratio code. The scale is from 1 to 9 where a crown class of one represents a crown ratio between 0 and 15 percent. A crown ratio code of 2 represents a crown ratio value between 16 and 25%,...,8=76-85%, 9 >=85%.
ba
Plot basal area at the beginning of the growth period.
dg
Five-year diameter increment.
hg
Five-year height increment.

Details

The exogenous variables are elev, smi, dbh, tht, cr, and ba; the endogenous variables dg and hg. There are no lagged variables in the dataset and the observations are for a single remeasurement.

The data was provided by the USDA Forest Service Intermountain Research Station.

Source

William R. Wykoff wwykoff@fs.fed.us Rocky Mountain Research Station, 1221 South Main Street, Moscow, ID 83843

Examples

data(ppine)


Predictions from System Estimation

Description

Returns the predicted values, their standard errors and the confidence limits of prediction.

Usage

## S3 method for class 'systemfit':
predict( object, data = object$data,
                             se.fit = FALSE, se.pred = FALSE,
                             interval = "none", level=0.95, ... )

## S3 method for class 'systemfit.equation':
predict( object, data, ... )

Arguments

object | an object of class systemfit or systemfit.equation.
data | data frame in which to predict.
se.fit | return the standard error of the fitted values?
se.pred | return the standard error of prediction?
interval | Type of interval calculation ("none", "confidence" or "prediction")
level | Tolerance/confidence level.
... | additional optional arguments.

Details

The variance of the fitted values (used to calculate the standard errors of the fitted values and the "confidence interval") is calculated by Var[E[y^0]-hat{y}^0]=x^0 ; Var[b] ; {x^0}'
The variances of the predicted values (used to calculate the standard errors of the predicted values and the "prediction intervals") is calculated by Var[y^0-hat{y}^0]=hat{σ}^2+x^0 ; Var[b] ; {x^0}'

Value

predict.systemfit returns a dataframe that contains for each equation the predicted values (e.g. "eq1.pred") and if requested the standard errors of the fitted values (e.g. "eq1.se.fit"), the standard errors of the prediction (e.g. "eq1.se.pred"), and the lower (e.g. "eq1.lwr") and upper (e.g. "eq1.upr") limits of the confidence or prediction interval(s).
predict.systemfit.equation returns a vector of the predicted values of a single equation.

Author(s)

Arne Henningsen ahenningsen@agric-econ.uni-kiel.de

References

Greene, W. H. (2003) Econometric Analysis, Fifth Edition, Macmillan.

Gujarati, D. N. (1995) Basic Econometrics, Third Edition, McGraw-Hill.

Kmenta, J. (1997) Elements of Econometrics, Second Edition, University of Michigan Publishing.

See Also

systemfit, predict

Examples

data( "Kmenta" )
demand <- consump ~ price + income
supply <- consump ~ price + farmPrice + trend
labels <- list( "demand", "supply" )
system <- list( demand, supply )

## OLS estimation
fitols <- systemfit("OLS", system, labels, data=Kmenta )

## predicted values and limits
predict( fitols )

## predicted values of the first equation
predict( fitols$eq[[1]] )

## predicted values of the second equation
predict( fitols$eq[[2]] )


Print confidence intervals of coefficients

Description

This function prints the confidence intervals of the coefficients of the estimated equation system.

Usage

   ## S3 method for class 'confint.systemfit':
   print( x, digits=3, ... )

Arguments

x | an object of type confint.systemfit.
digits | number of digits to print.
... | other arguments.

Author(s)

Arne Henningsen ahenningsen@agric-econ.uni-kiel.de

See Also

systemfit, confint.systemfit and confint.systemfit.equation

Examples

data( "Kmenta" )
demand <- consump ~ price + income
supply <- consump ~ price + farmPrice + trend
labels <- list( "demand", "supply" )
system <- list( demand, supply )

## perform OLS on each of the equations in the system
fitols <- systemfit( "OLS", system, labels, data = Kmenta )

## calculate and print the confidence intervals
## of all coefficients
ci <- confint( fitols )
print( ci, digits=4 )

## calculate and print the confidence intervals
## of the coefficients of the second equation
ci2 <- confint( fitols$eq[[2]] )
print( ci2, digits=4 )


Print output of nlsystemfit estimation

Description

These functions print a summary of the estimated equation system.

Usage

   ## S3 method for class 'nlsystemfit.system':
   print( x, digits=6, ... )

   ## S3 method for class 'nlsystemfit.equation':
   print( x, digits=6, ... )

Arguments

x | an object of class nlsystemfit.system or nlsystemfit.equation.
digits | number of digits to print.
... | not used by user.

Author(s)

Jeff D. Hamann jeff.hamann@forestinformatics.com

See Also

nlsystemfit, summary.nlsystemfit.system

Examples

library( systemfit )
data( ppine )

hg.formula <- hg ~ exp( h0 + h1*log(tht) + h2*tht^2 + h3*elev + h4*cr)
dg.formula <- dg ~ exp( d0 + d1*log(dbh) + d2*hg + d3*cr + d4*ba  )
labels <- list( "height.growth", "diameter.growth" )
inst <- ~ tht + dbh + elev + cr + ba
start.values <- c(h0=-0.5, h1=0.5, h2=-0.001, h3=0.0001, h4=0.08,
                  d0=-0.5, d1=0.009, d2=0.25, d3=0.005, d4=-0.02 )
model <- list( hg.formula, dg.formula )

model.ols <- nlsystemfit( "OLS", model, start.values, data=ppine, eqnlabels=labels )
print( model.ols )

model.3sls <- nlsystemfit( "3SLS", model, start.values, data=ppine,
                                    eqnlabels=labels, inst=inst )
print( model.3sls )


Print results of systemfit estimation

Description

These functions print a few results of the estimated equation system.

Usage

   ## S3 method for class 'systemfit':
   print( x, digits=6, ... )

   ## S3 method for class 'systemfit.equation':
   print( x, digits=6, ... )

Arguments

x | an object of class systemfit or systemfit.equation.
digits | number of digits to print.
... | other arguments.

Author(s)

Jeff D. Hamann jeff.hamann@forestinformatics.com,
Arne Henningsen ahenningsen@agric-econ.uni-kiel.de

See Also

systemfit, summary.systemfit

Examples

data( "Kmenta" )
demand <- consump ~ price + income
supply <- consump ~ price + farmPrice + trend
labels <- list( "demand", "supply" )
system <- list( demand, supply )

## perform OLS on each of the equations in the system
fitols <- systemfit( "OLS", system, labels, data = Kmenta )

## results of the whole system
print( fitols )

## results of the first equation
print( fitols$eq[[1]] )

## results of the second equation
print( fitols$eq[[2]] )


Residuals of systemfit object

Description

These functions extract the residuals from an object returned by systemfit.

Usage

   ## S3 method for class 'systemfit':
   residuals( object, ... )

   ## S3 method for class 'systemfit.equation':
   residuals( object, ... )

Arguments

object | an object of class systemfit or systemfit.equation.
... | other arguments.

Value

residuals.systemfit returns a matrix of residuals. Each column contains the residuals of one equation.
residuals.systemfit.equation returns a vector of residuals.

Author(s)

Arne Henningsen ahenningsen@agric-econ.uni-kiel.de

See Also

systemfit, residuals

Examples

data( "Kmenta" )
demand <- consump ~ price + income
supply <- consump ~ price + farmPrice + trend
labels <- list( "demand", "supply" )
system <- list( demand, supply )

## perform OLS on each of the equations in the system
fitols <- systemfit( "OLS", system, labels, data = Kmenta )

## residuals of all equations
residuals( fitols )

## residuals of the first equation
residuals( fitols$eq[[1]] )

## residuals of the second equation
residuals( fitols$eq[[2]] )


Ratio of the Standard Errors

Description

se.ratio.systemfit returns a vector of the ratios of the standard errors of the predictions for two equations.

Usage

se.ratio.systemfit( resultsi, resultsj, eqni )

Arguments

resultsi | an object of type systemfit.
resultsj | an object of type systemfit.
eqni | index for equation to obtain the ratio of standard errors.

Value

se.ratio returns a vector of the standard errors of the ratios for the predictions between the predicted values in equation i and equation j.

Author(s)

Jeff D. Hamann jeff.hamann@forestinformatics.com

References

Hasenauer, H; Monserud, R and T. Gregoire. (1998) Using Simultaneous Regression Techniques with Individual-Tree Growth Models. Forest Science. 44(1):87-95

See Also

systemfit and correlation.systemfit

Examples

data( "Kmenta" )
demand <- consump ~ price + income
supply <- consump ~ price + farmPrice + trend
inst <- ~ income + farmPrice + trend
labels <- list( "demand", "supply" )
system <- list( demand, supply )

## perform 2SLS on each of the equations in the system
fit2sls <- systemfit( "2SLS", system, labels, inst, data = Kmenta )
fit3sls <- systemfit( "3SLS", system, labels, inst, data = Kmenta )

## print the results from the fits
print( fit2sls )
print( fit3sls )
print( "covariance of residuals used for estimation (from 2sls)" )
print( fit3sls$rcovest )
print( "covariance of residuals" )
print( fit3sls$rcov )

## examine the improvement of 3SLS over 2SLS by computing
## the ratio of the standard errors of the estimates
improve.ratio <- se.ratio.systemfit( fit2sls, fit3sls, 2 )
print( "summary values for the ratio in the std. err. for the predictions" )
print( summary( improve.ratio ) )


Summary of nlsystemfit estimation

Description

These functions print a summary of the estimated equation system.

Usage

   ## S3 method for class 'nlsystemfit.system':
   summary( object, ... )

   ## S3 method for class 'nlsystemfit.equation':
   summary( object, ... )

Arguments

object | an object of class nlsystemfit.system or nlsystemfit.equation.
... | not used by user.

Author(s)

Jeff D. Hamann jeff.hamann@forestinformatics.com

See Also

nlsystemfit, print.nlsystemfit.system

Examples

library( systemfit )
data( ppine )

hg.formula <- hg ~ exp( h0 + h1*log(tht) + h2*tht^2 + h3*elev + h4*cr)
dg.formula <- dg ~ exp( d0 + d1*log(dbh) + d2*hg + d3*cr + d4*ba  )
labels <- list( "height.growth", "diameter.growth" )
inst <- ~ tht + dbh + elev + cr + ba
start.values <- c(h0=-0.5, h1=0.5, h2=-0.001, h3=0.0001, h4=0.08,
                  d0=-0.5, d1=0.009, d2=0.25, d3=0.005, d4=-0.02 )
model <- list( hg.formula, dg.formula )

model.ols <- nlsystemfit( "OLS", model, start.values, data=ppine, eqnlabels=labels )
print( model.ols )

model.3sls <- nlsystemfit( "3SLS", model, start.values, data=ppine,
                                    eqnlabels=labels, inst=inst )
print( model.3sls )


Summary of systemfit estimation

Description

These functions create and print summary results of the estimated equation system.

Usage

   ## S3 method for class 'systemfit':
   summary( object, ... )

   ## S3 method for class 'systemfit.equation':
   summary( object, ... )

   ## S3 method for class 'summary.systemfit':
   print( x, digits = 6, ... )

   ## S3 method for class 'summary.systemfit.equation':
   print( x, digits = 6, ... )

Arguments

object | an object of class systemfit or systemfit.equation.
x | an object of class summary.systemfit or summary.systemfit.equation.
digits | number of digits to print.
... | not used by user.

Author(s)

Jeff D. Hamann jeff.hamann@forestinformatics.com,
Arne Henningsen ahenningsen@agric-econ.uni-kiel.de

See Also

systemfit, print.systemfit

Examples

data( "Kmenta" )
demand <- consump ~ price + income
supply <- consump ~ price + farmPrice + trend
inst <- ~ income + farmPrice + trend
labels <- list( "demand", "supply" )
system <- list( demand, supply )

## perform OLS on each of the equations in the system
fitols <- systemfit( "OLS", system, labels, data = Kmenta )

## results of the whole system
summary( fitols )

## results of the first equation
summary( fitols$eq[[1]] )

## results of the second equation
summary( fitols$eq[[2]] )


Linear Equation System Estimation

Description

Fits a set of linear structural equations using Ordinary Least Squares (OLS), Weighted Least Squares (WLS), Seemingly Unrelated Regression (SUR), Two-Stage Least Squares (2SLS), Weighted Two-Stage Least Squares (W2SLS) or Three-Stage Least Squares (3SLS).

Usage

systemfit( method, eqns, eqnlabels=names(eqns),
           inst=NULL, data=list(), R.restr=NULL,
           q.restr=matrix(0,max(nrow(R.restr),0),1),
           TX=NULL, maxiter=1, tol=1e-5,
           rcovformula=1, centerResiduals = FALSE, formula3sls="GLS",
           probdfsys=!(is.null(R.restr) & is.null(TX)),
           single.eq.sigma=(is.null(R.restr) & is.null(TX)),
           solvetol=.Machine$double.eps,
           saveMemory=( nrow(data) * length(eqns) > 1000 &&
              length(data) > 0 ) )

systemfitClassic( method, formula, eqnVar, timeVar, data,
                  pooled = FALSE, ... )

Arguments

method | the estimation method, one of "OLS", "WLS", "SUR", "WSUR", "2SLS", "W2SLS", "3SLS", or "W3SLS" (see details); iterated estimation methods can be specified by setting argument maxiter larger than 1 (e.g. 500).
eqns | a list of structural equations to be estimated; a regression constant is implied if not explicitly omitted.
eqnlabels | an optional list of character vectors of names for the equation labels.
inst | one-sided model formula specifying instrumental variables or a list of one-sided model formulas if different instruments should be used for the different equations (only needed for 2SLS, W2SLS and 3SLS estimations).
data | an optional data frame containing the variables in the model. By default the variables are taken from the environment from which systemfit is called.
R.restr | an optional j x k matrix to impose linear restrictions on the parameters by R.restr * b = q.restr (j = number of restrictions, k = number of all parameters, b = vector of all parameters).
q.restr | an optional j x 1 matrix to impose linear restrictions (see R.restr); default is a j x 1 matrix that contains only zeros.
TX | an optional matrix to transform the regressor matrix and, hence, also the coefficient vector (see details).
maxiter | maximum number of iterations for WLS, SUR, W2SLS and 3SLS estimations.
tol | tolerance level indicating when to stop the iteration (only WLS, SUR, W2SLS and 3SLS estimations).
rcovformula | formula to calculate the estimated residual covariance matrix (see details).
centerResiduals | logical. Subtract the means from the residuals of each equation before calculating the estimated residual covariance matrix.
formula3sls | formula for calculating the 3SLS estimator, one of "GLS", "IV", "GMM", "Schmidt" or "EViews" (see details).
probdfsys | use the degrees of freedom of the whole system (in place of the degrees of freedom of the single equation) to calculate prob values for the t-test of individual parameters.
single.eq.sigma | use different σ^2s for each single equation to calculate the covariance matrix and the standard errors of the coefficients (only OLS and 2SLS).
solvetol | tolerance level for detecting linear dependencies when inverting a matrix or calculating a determinant (see solve and det).
saveMemory | logical. Save memory by omitting some calculation that are not crucial for the basic estimation (e.g McElroy's R^2)?
formula | formula to be estimated (for each equation).
eqnVar | variable name indicating the equation to which the observation belongs.
timeVar | variable name indicating the time.
pooled | logical, restrict coefficients to be equal in all equations.
... | arguments passed to systemfit.

Details

systemfitClassic is a wrapper function for systemfit that can be applied to panel-like data in long format if the regressors are the same for all equations.

If argument method is "WSUR" or "W3SLS", the "SUR" or "3SLS" estimation uses a residual variance covariance matrix that is calculated from a "WLS" or "W2SLS" estimation, respectively (and not from an "OLS" or "2SLS" estimation as for a standard "SUR" or "3SLS" estimation). The "WSUR" method is the default method of command "TSCS" in the software LIMDEP that carries out "SUR" estimations in which all coefficient vectors are constrained to be equal (personal information from W.H. Greene, 2006/02/16). If no cross-equation restrictions are imposed, "WSUR" and "W3SLS" generate identical results compared to "SUR" and "3SLS", respectively.

The matrix TX transforms the regressor matrix (X) by X^{*} = X * TX. Thus, the vector of coefficients is now b = TX cdot b^{*} , where b is the original (stacked) vector of all coefficients and b^{*} is the new coefficient vector that is estimated instead. Thus, the elements of vector b are b_i = sum_j TX_{ij} cdot b^{*}_j
The TX matrix can be used to change the order of the coefficients and also to restrict coefficients (if TX has less columns than it has rows). However restricting coefficients by the TX matrix is less powerfull and flexible than the restriction by providing the R.restr matrix and the q.restr vector. The advantage of restricting the coefficients by the TX matrix is that the matrix that is inverted for estimation gets smaller by this procedure, while it gets larger if the restrictions are imposed by R.restr and q.restr.

If iterated (WLS, SUR, W2SLS or 3SLS estimation with maxit>1), the convergence criterion is

sqrt{ frac{ sum_i (b_{i,g} - b_{i,g-1})^2 }{ sum_i b_{i,g-1}^2 }} < tol

(b_{i,g} is the ith coefficient of the gth iteration step).

The formula to calculate the estimated covariance matrix of the residuals (hat{Σ}) can be one of the following (see Judge et al., 1985, p. 469):
if rcovformula=0:

hat{σ}_{ij} = frac{hat{e}_i' hat{e}_j}{T}

if rcovformula=1 or rcovformula='geomean':

hat{σ}_{ij} = frac{hat{e}_i' hat{e}_j} {sqrt{(T - k_i)*(T - k_j)}}

if rcovformula=2 or rcovformula='Theil':

hat{σ}_{ij} = frac{hat{e}_i' hat{e}_j}{T - k_i - k_j + tr[X_i(X_i'X_i)^{-1}X_i'X_j(X_j'X_j)^{-1}X_j']}

if rcovformula=3 or rcovformula='max':

hat{σ}_{ij} = frac{hat{e}_i' hat{e}_j} {T - max( k_i, k_j)}

If i = j, formula 1, 2 and 3 are equal. All these three formulas yield unbiased estimators for the diagonal elements of the residual covariance matrix. If i neq j, only formula 2 yields an unbiased estimator for the residual covariance matrix, but it is not neccessarily positive semidefinit. Thus, it is doubtful whether formula 2 is really superior to formula 1 (Theil, 1971, p. 322).

The formulas to calculate the 3SLS estimator lead to identical results if the same instruments are used in all equations. If different instruments are used in the different equations, only the GMM-3SLS estimator ("GMM") and the 3SLS estimator proposed by Schmidt (1990) ("Schmidt") are consistent, whereas "GMM" is efficient relative to "Schmidt" (see Schmidt, 1990).

Value

systemfit returns a list of the class systemfit and contains all results that belong to the whole system. This list contains one special object: "eq". It is a list and contains one object for each estimated equation. These objects are of the class systemfit.equation and contain the results that belong only to the regarding equation.
The objects of the class systemfit and systemfit.equation have the following components (the elements of the latter are marked with an asterisk (*)):

method | estimation method.
g | number of equations.
n | total number of observations.
k | total number of coefficients.
ki | total number of linear independent coefficients.
df | degrees of freedom of the whole system.
iter | number of iteration steps.
b | vector of all estimated coefficients.
bt | coefficient vector transformed by TX.
se | estimated standard errors of b.
t | t values for b.
p | p values for b.
bcov | estimated covariance matrix of b.
btcov | covariance matrix of bt.
rcov | estimated residual covariance matrix.
drcov | determinant of rcov.
rcovest | residual covariance matrix used for estimation (only SUR and 3SLS).
olsr2 | System OLS R-squared value.
mcelr2 | McElroys R-squared value for the system (only SUR and 3SLS).
y | vector of all (stacked) endogenous variables
x | matrix of all (diagonally stacked) regressors
h | matrix of all (diagonally stacked) instrumental variables (only 2SLS and 3SLS)
data | data frame of the whole system (including instruments)
R.restr | the restriction matrix.
q.restr | the restriction vector.
TX | matrix used to transform the regressor matrix.
maxiter | maximum number of iterations.
tol | tolerance level indicating when to stop the iteration
rcovformula | formula to calculate the estimated residual covariance matrix
formula3sls | formula for calculating the 3SLS estimator.
probdfsys | system degrees of freedom to calculate prob values?.
single.eq.sigma | different σ^2s for each single equation?.
solvetol | tolerance level when inverting a matrix or calculating a determinant.
data.name | name of the data.frame used for estimation.
eq | a list that contains the results that belong to the individual equations.
eqnlabel* | the equation label of the ith equation (from the labels list).
formula* | model formula of the ith equation.
inst* | instruments of the ith equation (only 2SLS and 3SLS).
n* | number of observations of the ith equation.
k* | number of coefficients/regressors in the ith equation (including the constant).
ki* | number of linear independent coefficients in the ith equation (including the constant differs from k only if there are restrictions that are not cross-equation).
df* | degrees of freedom of the ith equation.
b* | estimated coefficients of the ith equation.
se* | estimated standard errors of b.
t* | t values for b.
p* | p values for b.
covb* | estimated covariance matrix of b.
y* | vector of endogenous variable (response values) of the ith equation.
x* | matrix of regressors (model matrix) of the ith equation.
h* | matrix of instrumental variables of the ith equation (only 2SLS and 3SLS).
data* | data frame (including instruments) of the ith equation.
fitted* | vector of fitted values of the ith equation.
residuals* | vector of residuals of the ith equation.
ssr* | sum of squared residuals of the ith equation.
mse* | estimated variance of the residuals (mean of squared errors) of the ith equation.
s2* | estimated variance of the residuals (hat{σ}^2) of the ith equation.
rmse* | estimated standard error of the residulas (square root of mse) of the ith equation.
s* | estimated standard error of the residuals (hat{σ}) of the ith equation.
r2* | R-squared (coefficient of determination).
adjr2* | adjusted R-squared value.

Author(s)

Jeff D. Hamann jeff.hamann@forestinformatics.com,
Arne Henningsen ahenningsen@agric-econ.uni-kiel.de

References

Greene, W. H. (2003) Econometric Analysis, Fifth Edition, Prentice Hall.

Judge, George G.; W. E. Griffiths; R. Carter Hill; Helmut Lütkepohl and Tsoung-Chao Lee (1985) The Theory and Practice of Econometrics, Second Edition, Wiley.

Kmenta, J. (1997) Elements of Econometrics, Second Edition, University of Michigan Publishing.

Schmidt, P. (1990) Three-Stage Least Squares with different Instruments for different equations, Journal of Econometrics 43, p. 389-394.

Theil, H. (1971) Principles of Econometrics, Wiley, New York.

See Also

lm and nlsystemfit

Examples

data( "Kmenta" )
eqDemand <- consump ~ price + income
eqSupply <- consump ~ price + farmPrice + trend
system <- list( demand = eqDemand, supply = eqSupply )

## OLS estimation
fitols <- systemfit("OLS", system, data=Kmenta )
print( fitols )

## OLS estimation with 2 restrictions
Rrestr <- matrix(0,2,7)
qrestr <- matrix(0,2,1)
Rrestr[1,3] <-  1
Rrestr[1,7] <- -1
Rrestr[2,2] <- -1
Rrestr[2,5] <-  1
qrestr[2,1] <-  0.5
fitols2 <- systemfit("OLS", system, data = Kmenta,
                      R.restr = Rrestr, q.restr = qrestr )
print( fitols2 )

## iterated SUR estimation
fitsur <- systemfit("SUR", system, data = Kmenta, maxit = 100 )
print( fitsur )

## 2SLS estimation
inst <- ~ income + farmPrice + trend
fit2sls <- systemfit( "2SLS", system, inst = inst, data = Kmenta )
print( fit2sls )

## 2SLS estimation with different instruments in each equation
inst1 <- ~ income + farmPrice
inst2 <- ~ income + farmPrice + trend
instlist <- list( inst1, inst2 )
fit2sls2 <- systemfit( "2SLS", system, inst = instlist, data = Kmenta )
print( fit2sls2 )

## 3SLS estimation with GMM-3SLS formula
inst <- ~ income + farmPrice + trend
fit3sls <- systemfit( "3SLS", system, inst = inst, data = Kmenta,
   formula3sls = "GMM" )
print( fit3sls )

## Examples how to use systemfitClassic()
## Repeating the OLS and SUR estimations in Theil (1971, pp. 295, 300)
data( "GrunfeldTheil" )
formulaGrunfeld <- invest ~ value + capital
# OLS
theilOls <- systemfitClassic( "OLS", formulaGrunfeld, "firm", "year",
   data = GrunfeldTheil )
summary( theilOls )
# SUR
theilSur <- systemfitClassic( "SUR", formulaGrunfeld, "firm", "year",
   data = GrunfeldTheil, rcovformula = 0 )
summary( theilSur )

## Further examples are in the documentation to the data sets
## 'KleinI' and 'GrunfeldGreene'.


Internal systemfit functions

Description

Internal systemfit functions

Usage

knls( theta, eqns, data, fitmethod="OLS", parmnames, instr=NULL, S=NULL )

Details

These functions are no the called by the user. The knls is the driver function that is passed to the nlm call in nlsystemfit.


Variance covariance matrix of coefficients

Description

These functions extract the variance covariance matrix of the coefficients from an object returned by systemfit.

Usage

   ## S3 method for class 'systemfit':
   vcov( object, ... )

   ## S3 method for class 'systemfit.equation':
   vcov( object, ... )

Arguments

object | an object of class systemfit or systemfit.equation.
... | other arguments.

Value

vcov.systemfit returns the variance covariance matrix of all estimated coefficients.

Author(s)

Arne Henningsen ahenningsen@agric-econ.uni-kiel.de

See Also

systemfit, vcov

Examples

data( "Kmenta" )
demand <- consump ~ price + income
supply <- consump ~ price + farmPrice + trend
labels <- list( "demand", "supply" )
system <- list( demand, supply )

## perform OLS on each of the equations in the system
fitols <- systemfit( "OLS", system, labels, data = Kmenta )

## variance covariance matrix of all coefficients
vcov( fitols )

## variance covariance matrix of the coefficients in the first equation
vcov( fitols$eq[[1]] )

## variance covariance matrix of the coefficients in the second equation
vcov( fitols$eq[[2]] )


Wald-test for Equation Systems

Description

Wald-test for linear parameter restrictions in equation systems.

Usage

   waldtest.systemfit( object, R.restr,
      q.restr = rep( 0, nrow( R.restr ) ) )

   ## S3 method for class 'waldtest.systemfit':
   print( x, digits = 4, ... )

Arguments

object | an object of type systemfit.
R.restr | j x k matrix to impose linear restrictions on the parameters by R.restr * b = q.restr (j = number of restrictions, k = number of all parameters, b = vector of all parameters).
q.restr | an optional vector with j elements to impose linear restrictions (see R.restr); default is a vector that contains only zeros.
x | an object of class waldtest.systemfit.
digits | number of digits to print.
... | currently not used.

Details

The Wald-statistic for sytems of equations is

W = ( R hat{b} - q )' ( R widehat{Cov} [ hat{b} ] R' )^{-1} ( R hat{b} - q )

Asymptotically, W has a chi^2 distribution with j degrees of freedom under the null hypothesis (Greene, 2003, p. 347).

Value

waldtest.systemfit returns a list of class waldtest.systemfit that includes following objects:

statistic | the empirical Wald statistic.
p.value | the p-value of the Wald-test.
nRestr | number of restrictions (j, degrees of freedom).

Author(s)

Arne Henningsen ahenningsen@agric-econ.uni-kiel.de

References

Greene, W. H. (2003) Econometric Analysis, Fifth Edition, Prentice Hall.

See Also

systemfit, ftest.systemfit, lrtest.systemfit

Examples

data( "Kmenta" )
eqDemand <- consump ~ price + income
eqSupply <- consump ~ price + farmPrice + trend
system <- list( demand = eqDemand, supply = eqSupply )

## unconstrained SUR estimation
fitsur <- systemfit( "SUR", system, data=Kmenta )

# create restriction matrix to test whether \eqn{beta_2 = \beta_6}
R1 <- matrix( 0, nrow = 1, ncol = 7 )
R1[ 1, 2 ] <- 1
R1[ 1, 6 ] <- -1

## perform Wald-test
waldTest1 <- waldtest.systemfit( fitsur, R1 )
print( waldTest1 )   # rejected

# create restriction matrix to test whether \eqn{beta_2 = - \beta_6}
R2 <- matrix( 0, nrow = 1, ncol = 7 )
R2[ 1, 2 ] <- 1
R2[ 1, 6 ] <- 1

## perform Wald-test
waldTest2 <- waldtest.systemfit( fitsur, R2 )
print( waldTest2 )   # accepted