# Illustrations of use of the "restrict" command
open data4-10

# initial OLS
ols 1 0 2 3 4 5

# Evaluate two zero restrictions
restrict --quiet
  b[4] = 0
  b[5] = 0
end restrict

# Equivalent: use the "omit" command
omit 4 5

# Now try a test for equality of coefficients
ols 1 0 2 3 4 5
restrict --quiet
  b[4] - b[5] = 0
end restrict

# Manual equivalent to the above...
genr essu = $ess
genr dfu = $df
genr vsum = WHITE + ADMEXP
ols 1 0 2 3 vsum
genr essr = $ess
genr Fval = (essr - essu)/(essu/dfu)
pvalue F 1 dfu Fval 

# Try testing for sum of coefficients
ols 1 0 2 3 4 5
restrict --quiet
  b[WHITE] + b[ADMEXP] = 0
end restrict

# Alternative method (t-test)
coeffsum WHITE ADMEXP


