Description Usage Arguments Details Value Author(s) References See Also Examples
Fits a set of linear structural equations using Ordinary Least Squares (OLS), Weighted Least Squares (WLS), Seemingly Unrelated Regression (SUR), TwoStage Least Squares (2SLS), Weighted TwoStage Least Squares (W2SLS) or ThreeStage Least Squares (3SLS).
1 2 3 4 
formula 
an object of class 
method 
the estimation method, one of "OLS", "WLS", "SUR",
"2SLS", "W2SLS", or "3SLS" (see details);
iterated estimation methods can be specified by setting control parameter

inst 
onesided model formula specifying the instrumental variables (including exogenous explanatory variables) or a list of onesided 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. 
restrict.matrix 
an optional j x k matrix to impose linear
restrictions on the coefficients by 
restrict.rhs 
an optional vector with j elements to impose linear
restrictions (see 
restrict.regMat 
an optional matrix to impose restrictions on the coefficients by postmultiplying the regressor matrix with this matrix (see details). 
control 
list of control parameters.
The default is constructed by the function 
pooled 
logical, restrict coefficients to be equal in all equations (only for panellike data). 
... 
arguments passed to 
The estimation of systems of equations with unequal numbers
of observations has not been thoroughly tested yet.
Currently, systemfit
calculates the residual covariance matrix
only from the residuals/observations that are available
in all equations.
If argument data
is of class pdata.frame
(created with pdata.frame()
and thus, contains panel data in long format),
argument formula
must be a single equation
that is applied to all individuals.
In this case, argument pooled
specifies
whether the coefficients are restricted to be equal for all
individuals.
If argument restrict.regMat
is specified,
the regressor matrix X is postmultiplied by this matrix:
X^{*} = X \cdot restrict.regMat
.
Then, this modified regressor matrix X^{*} is used for the
estimation of the coefficient vector b^{*}.
This means that the coefficients of the original regressors (X),
vector b,
can be represented by b = restrict.regMat
\cdot b^{*}.
If restrict.regMat
is a nonsingular quadratic matrix,
there are no restrictions on the coefficients imposed,
but the coefficients b^{*} are linear combinations of
the original coefficients b.
If restrict.regMat
has less columns than rows,
linear restrictions are imposed on the coefficients b.
However, imposing linear restrictions
by the restrict.regMat
matrix is less flexible than
by providing the matrix restrict.matrix
and the
vector restrict.rhs
.
The advantage of imposing restrictions on the coefficients
by the matrix restrict.regMat
is that the matrix,
which has to be inverted during the estimation,
gets smaller by this procedure, while it gets larger
if the restrictions are imposed by restrict.matrix
and restrict.rhs
.
In the context of multiequation models, the term “weighted” in “weighted least squares” (WLS) and “weighted twostage least squares” (W2SLS) means that the equations might have different weights and not that the observations have different weights.
It is important to realize the limitations on estimating the residuals covariance matrix imposed by the number of observations T in each equation. With g equations we estimate g*(g+1)/2 elements using T*g observations total. Beck and Katz (1995,1993) discuss the issue and the resulting overconfidence when the ratio of T/g is small (e.g. 3). Even for T/g=5 the estimate is unstable both numerically and statistically and the 95 approximately [0.5*s^2, 3*s^2], which is inadequate precision if the covariance matrix will be used for simulation of asset return paths either for investment or risk management decisions. For a starter on models with large crosssections see Reichlin (2002). [This paragraph has been provided by Stephen C. Bond – Thanks!]
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 (*)):
call 
the matched call. 
method 
estimation method. 
rank 
total number of linear independent coefficients = number of coefficients minus number of linear restrictions. 
df.residual 
degrees of freedom of the whole system. 
iter 
number of iteration steps. 
coefficients 
vector of all estimated coefficients. 
coefCov 
estimated covariance matrix of 
residCov 
estimated residual covariance matrix. 
residCovEst 
residual covariance matrix used for estimation (only WLS, W2SLS, SUR and 3SLS). 
restrict.matrix 
the restriction matrix. 
restrict.rhs 
the restriction vector. 
restrict.regMat 
matrix used to impose restrictions on the coefficients by postmultiplying the regressor matrix with this matrix. 
control 
list of control parameters used for the estimation. 
panelLike 
logical. Was this an analysis with panellike data? 
## elements of the class systemfit.eq
eq 
a list that contains the results that belong to the individual equations. 
eqnLabel* 
the label of this equation. 
eqnNo* 
the number of this equation. 
terms* 
the 'terms' object used for the ith equation. 
inst* 
instruments of the ith equation (only 2SLS, W2SLS, and 3SLS). 
termsInst* 
the 'terms' object of the instruments used for the ith equation (only 2SLS, W2SLS, and 3SLS). 
rank* 
number of linear independent coefficients in the ith equation (differs from the number of coefficients only if there are restrictions that are not crossequation). 
nCoef.sys* 
total number of coefficients in all equations. 
rank.sys* 
total number of linear independent coefficients in all equations. 
df.residual* 
degrees of freedom of the ith equation. 
df.residual.sys* 
degrees of freedom of the whole system. 
coefficients* 
estimated coefficients of the ith equation. 
covb* 
estimated covariance matrix of 
model* 
if requested (the default), the model frame of the ith equation. 
modelInst* 
if requested (the default), the model frame of the instrumental variables of the ith equation (only 2SLS, W2SLS, and 3SLS). 
x* 
if requested, the model matrix of the ith equation. 
y* 
if requested, the response of the ith equation. 
z* 
if requested, the matrix of instrumental variables of the ith equation (only 2SLS, W2SLS, and 3SLS). 
fitted.values* 
vector of fitted values of the ith equation. 
residuals* 
vector of residuals of the ith equation. 
Arne Henningsen [email protected],
Jeff D. Hamann [email protected]
Beck, N.; J.N. Katz (1995) What to do (and not to do) with TimeSeries CrossSection Data, The American Political Science Review, 89, pp. 634647.
Beck, N.; J.N. Katz; M.R. Alvarez; G. Garrett; P. Lange (1993) Government Partisanship, Labor Organization, and Macroeconomic Performance: a Corrigendum, American Political Science Review, 87, pp. 94548.
Greene, W. H. (2003) Econometric Analysis, Fifth Edition, Prentice Hall.
Judge, George G.; W. E. Griffiths; R. Carter Hill; Helmut Luetkepohl and TsoungChao Lee (1985) The Theory and Practice of Econometrics, Second Edition, Wiley.
Kmenta, J. (1997) Elements of Econometrics, Second Edition, University of Michigan Publishing.
Reichlin, L. (2002) Factor models in large crosssections of time series, Working Paper, ECARES and CEPR.
Schmidt, P. (1990) ThreeStage Least Squares with different Instruments for different equations, Journal of Econometrics 43, p. 389394.
Theil, H. (1971) Principles of Econometrics, Wiley, New York.
lm
and nlsystemfit
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86  data( "Kmenta" )
eqDemand < consump ~ price + income
eqSupply < consump ~ price + farmPrice + trend
system < list( demand = eqDemand, supply = eqSupply )
## OLS estimation
fitols < systemfit( system, data=Kmenta )
print( fitols )
## OLS estimation with 2 restrictions
Rrestr < matrix(0,2,7)
Rrestr[1,3] < 1
Rrestr[1,7] < 1
Rrestr[2,2] < 1
Rrestr[2,5] < 1
qrestr < c( 0, 0.5 )
fitols2 < systemfit( system, data = Kmenta,
restrict.matrix = Rrestr, restrict.rhs = qrestr )
print( fitols2 )
## OLS estimation with the same 2 restrictions in symbolic form
restrict < c( "demand_income  supply_trend = 0",
" demand_price + supply_price = 0.5" )
fitols2b < systemfit( system, data = Kmenta, restrict.matrix = restrict )
print( fitols2b )
# test whether both restricted estimators are identical
all.equal( coef( fitols2 ), coef( fitols2b ) )
## OLS with restrictions on the coefficients by modifying the regressor matrix
## with argument restrict.regMat
modReg < matrix( 0, 7, 6 )
colnames( modReg ) < c( "demIntercept", "demPrice", "demIncome",
"supIntercept", "supPrice2", "supTrend" )
modReg[ 1, "demIntercept" ] < 1
modReg[ 2, "demPrice" ] < 1
modReg[ 3, "demIncome" ] < 1
modReg[ 4, "supIntercept" ] < 1
modReg[ 5, "supPrice2" ] < 1
modReg[ 6, "supPrice2" ] < 1
modReg[ 7, "supTrend" ] < 1
fitols3 < systemfit( system, data = Kmenta, restrict.regMat = modReg )
print( fitols3 )
## iterated SUR estimation
fitsur < systemfit( system, "SUR", data = Kmenta, maxit = 100 )
print( fitsur )
## 2SLS estimation
inst < ~ income + farmPrice + trend
fit2sls < systemfit( system, "2SLS", 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( system, "2SLS", inst = instlist, data = Kmenta )
print( fit2sls2 )
## 3SLS estimation with GMM3SLS formula
inst < ~ income + farmPrice + trend
fit3sls < systemfit( system, "3SLS", inst = inst, data = Kmenta,
method3sls = "GMM" )
print( fit3sls )
## Examples how to use systemfit() with panellike data
## Repeating the SUR estimations in Greene (2003, p. 351)
data( "GrunfeldGreene" )
library( "plm" )
GGPanel < pdata.frame( GrunfeldGreene, c( "firm", "year" ) )
formulaGrunfeld < invest ~ value + capital
# SUR
greeneSur < systemfit( formulaGrunfeld, "SUR",
data = GGPanel, methodResidCov = "noDfCor" )
summary( greeneSur )
# SUR Pooled
greeneSurPooled < systemfit( formulaGrunfeld, "SUR",
data = GGPanel, pooled = TRUE, methodResidCov = "noDfCor",
residCovWeighted = TRUE )
summary( greeneSurPooled )
## Further examples are in the documentation to the data sets
## 'KleinI' and 'GrunfeldGreene'.

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.