program def irrepro
*! NJC 1.0.0 28 November 1998
        version 5.0
        local options "Symbol(str) Connect(str)"
        local options "`options' Black(int 1) White(int 1) Add(int 1) *"
        parse "`*'"

        capture set obs 200
        tempvar w pw t

        qui gen `w' = `white' in 1
        local b = `black'
        gen `t' = _n
        label var `t' "t"

        local i = 2
        qui while `i' <= _N {
                local random = uniform()
                local White = `random' < (`w'[`i'-1] / (`w'[`i'-1] + `b'))
                replace `w' = `w'[`i'-1] + `add' * `White' in `i'
                local b = `b' + `add' * (1 - `White')
                local i = `i' + 1
        }

        if "`symbol'" == "" { local symbol "." }
        if "`connect'" == "" { local connect "l" }

        gen `pw' = `w' / (`add' * (`t' - 1) + `white' + `black')
        label var `pw' "proportion white"
        local yvals "0,0.2,0.4,0.6,0.8,1"

        gra `pw' `t', t1("irreproducible results") yla(`yvals') xla /*
          */ c(`connect') sy(`symbol') gap(4) `options'
        global S_1 = `pw'[_N]
end