*! version 1.0 1/20/94
program define lorobwei
  version 3.0
  capture confirm v `1' `2'
  if _rc~=0 {
      di "syntax: lorobwei yvar yhat"
      exit}
  tempvar resi absres mad u absu
  quietly {
  gen `resi'= `1' - `2'
  gen `absres'= abs(`resi')
  summ `absres', detail
  gen `mad' = _result(10)
  gen robwei=0
  gen `u' = `resi'/(6*`mad')
  gen `absu'=abs(`u')
  replace robwei=(1-`u'^2)^2 if `absu'<1
  }
end