Learn R Programming

systemfit (version 0.5-6)

varcov: Variance-Covariance

Description

The function returns the variance-covaraince of the residuals for a set of equations from the residuals. The values of the elements are defined as, $$\frac{e_{i}'e_{j}}{\sqrt{n_i n_j}}$$ where $e_i$ and $e_j$ are the residuals and $n_i$ and $n_j$ are the error degrees of freedom for equations i and j.

Usage

varcov.systemfit( results )

Arguments

results
an object of type twostage.systemfit.

Value

  • varcov returns a variance-covaraince matrix of the residuals from a set of objects of class twostage.

References

Greene, W. H. (1993) Econometric Analysis, Second Edition, Macmillan. Kmenta, J. (1997) Elements of Econometrics, Second Edition, University of Michigan Publishing

See Also

ols,twostage,surand threestage

Examples

Run this code
library( systemfit )

data( kmenta )
attach( kmenta )
demand <- q ~ p + d
supply <- q ~ p + f + a
inst <- ~ d + f + a
labels <- list( "demand", "supply" )
system <- list( demand, supply )

## perform 2SLS on each of the equations in the system
fit2sls <- twostage.systemfit( system, inst, labels, kmenta )
fit3sls <- threestage.systemfit( system, inst, labels, kmenta )

## print the results
print( fit2sls )
print( fit3sls )
print( "covariance of residuals used for estimation (from 2sls)" )
print( varcov.systemfit( fit2sls ) )
print( "covariance of residuals" )
print( varcov.systemfit( fit3sls ) )

Run the code above in your browser using DataLab