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 the estimation and report the results for the whoel system
fit3sls <- threestage.systemfit( system, inst, labels, kmenta )
print( fit3sls )
## get the variance-covariance matrix used for estimation
print( "covariance of residuals used for estimation (from 2sls)" )
print( threestage.cov( fit3sls, 1, 2 ) )
Run the code above in your browser using DataLab