Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with "paralell" module when bootstrapping

    Dear Statalist community!
    To increase speed of a bootstrapping program, I tried out the "paralell" modul (https://github.com/gvegayon/parallel). Unfortunately, I get weird error message when trying to run parallel in my setting. Its most probably a very simple problem, but I cannot figure out. Any help is highly appreciated.

    My Stata version: 15.1

    I installed "paralell" modul as indicated on Github:

    ssc install parallel, replace
    parallel setclusters 4, f

    ***************************************
    My do-file:


    est clear
    global variab "laborforce "

    This here is my "program":

    capture program drop bivprobit_boot
    program bivprobit_boot, rclass
    set more off
    *the following four lines refer to macros that I use to run the biprobit model
    foreach var in $variab{
    foreach bw in obw {
    foreach per in per_base`var'`bw' {
    foreach ff in per_ff`var'`bw'{
    *baseline model
    biprobit (`var' = takeup $`ff' i.year ) (takeup = i.treat $`ff' i.year ) if $`per', cluster (hhid)
    eststo base`var'_`bw'
    *predict
    predict x1b1hat , xb1
    gen x1b1hat0 = x1b1hat- _b[takeup]*takeup
    gen x1b1hat1 = x1b1hat0 + _b[takeup]
    gen pe1 = normal(x1b1hat1) - normal(x1b1hat0)
    summarize pe1
    return scalar ape1= r(mean)
    drop x1b1hat x1b1hat0 x1b1hat1 pe1
    }
    }
    }
    }
    end

    Here starts the actual bootstrapping. When trying to run this I get the error message....

    foreach var in $variab {
    *bootstrapping
    parallel bs r(ape1), reps(50) seed(123): bivprobit_boot
    eststo bootstr`var'obw
    }

    ***********************************
    Stata output:

    . foreach var in $variab {
    2. *bootstrapping
    . parallel bs r(ape1), reps(50) seed(123): bivprobit_boot
    3. eststo bootstr`var'obw
    4. }
    invalid 'reps'
    r(198);

    ***********************************

    Does anyone have an idea what the problem could be?
    I'd appreciate this a lot!

    Best,

    Johanna

  • #2
    From reading the help file for -parallel- (ssc describe parallel), I see a couple of problems:

    parallel bs [, expression(exp_list) programs(namelist) mata noglobal seeds(numlist) randtype(current|datetime|random.org) timeout(integer) processors(integer) bs_options ] [: command]

    1) You need "expression(r(ape1))", and it must occur after the the comma. This is likely creating the r(198) error.
    However:
    2) The seeds() option requires more than one seed.

    -parallel- is a very impressive program, but in playing around with it a few times, I have found it difficult to properly follow the syntax. Also, at least for me, there is a bug in its updated help file, which makes it hard to read. I would suggest you try to get a simple example of -parallel- to run, and then work your way up to your fancier application. I for one would be interested to see a report back from you on what happens. I suspect we may need to get its creator/maintainer involved before we're done.

    Comment

    Working...
    X