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 )
Run the code above in your browser using DataLab