program def irrepron
*! NJC 1.0.0 28 November 1998
        version 5.0
        local options "Generate(string) Black(int 1) White(int 1) Add(int 1)"
        parse "`*'"

        if "`generat'" != "" { confirm new variable `generat' }

        capture set obs 200
        tempvar p
        qui gen `p' = .

        local i = 1
        while `i' <= _N {
                irrepro, b(`black') w(`white') a(`add')
                qui replace `p' = $S_1 in `i'
                local i = `i' + 1
        }
        label var `p' "proportion white"
        local n = _N
        distplot `p', t1(`n' replications of irrepro) /*
         */ l1(probability <= this proportion white)  /*
         */ xla(0,0.2,0.4,0.6,0.8,1) yla(0,0.2,0.4,0.6,0.8,1)

        if "`generat'" != "" {
                gen `generat' = `p'
        }
end