Announcement

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

  • Command -ritest- for randomization inference in Stata now available from SSC.

    Thanks to Kit Baum, -ritest- is now available for download from SSC. -ritest- is a module to conduct randomization inference and permutation tests, allowing for arbitrary randomization procedures

    The package can be installed using:
    Code:
     ssc install ritest
    A previous version of the command was published alongside a short Stata Journal article explaining how to use the command to perform various variants of randomization inference in Stata. The article is published here: http://www.stata-journal.com/article...article=st0489 With the ritest-command it becomes very easy to perform randomization inference for any kind of command in Stata. -ritest- is flexible enough to work with arbitrarily complex randomization methods. In particular it is very easy to deal with clustered randomization, pairwise randomization, or user-written any randomization routines in Stata.

    The current version on SSC is an updated version of the Stata Journal code with several bugfixes and a few new features. The full change-log is available here: https://github.com/simonheb/ritest/b...ster/README.md

    For regular updates and bugfixes, I recommend installing the package through my github, which is easy:
    Code:
    net describe ritest, from(https://raw.githubusercontent.com/simonheb/ritest/master/)
    Important updates will also be pushed to SSC.

    Usage
    The syntax of the command is close to that of Stata’s permute. For example, to conduct randomization inference after clustered & stratified treatment assignment, using the t-statistic of an ATE regression as the evaluation statistic run:
    Code:
    ritest treatment (_b[treatment]/_se[treatment]), cluster(class_id) strata(school_id): reg y treatment x
    (This just permutes treatment across classes within strata and computes the t-statistic of the ATE for each permutation)

    Or if, instead of permuting, one wants to apply the original randomization script to perform the re-randomizations one, but this time use the coefficient estimate as the evaluation statistic, simply write:
    Code:
    ritest treatment _b[treatment], samplingprogram(assignment_programm) samplingprogramoptions("school(school_id) class(class_id)"): reg y treatment x
    (This repeatedly calls a program that re-assigns treatment. The user has to define the program beforehand: assignment_programm, school(schoold_id) class(class_id))

    For questions/requests please use the github issue-tracking system: https://github.com/simonheb/ritest/issues

  • #2
    Hello,

    Apologize in advance for a very basic question.
    To check for the statistical significance of a variable in a linear regression with ritest, should I be checking for:
    a) Its coefficient
    Code:
    ritest variable _b[variable]
    or
    b) Its t-statistic
    Code:
    ritest variable (_b[variable]/_se[variable])
    __________________________________________________ _________
    My situation is this...
    I have the following linear regression:
    Code:
    . reg y ctrl ctrl_square x1 x2
    
    ------------------------------------------------------------------------------
               y | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
            ctrl |     .00937   .0050835     1.84   0.066    -.0006344    .0193744
     ctrl_square |  -.0000195    .000012    -1.63   0.104    -.0000431    4.02e-06
              x1 |   .2306117   .0852692     2.70   0.007     .0628009    .3984225
              x2 |  -.0322865   .0948172    -0.34   0.734    -.2188878    .1543147
           _cons |   1.873839   .5680238     3.30   0.001     .7559624    2.991716
    ------------------------------------------------------------------------------
    We see that ctrl_square is non-significant, with with p=0.104.

    But, using ritest checking for the coefficient I get the following:
    Code:
    ritest ctrl_square _b[ctrl_square], reps(1000) seed(123): reg y ctrl ctrl_square x1 x2
    .
    .
    ------------------------------------------------------------------------------
    T            |     T(obs)       c       n   p=c/n   SE(p) [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           _pm_1 |  -.0000195       0    1000  0.0000  0.0000         0   .0036821
    ------------------------------------------------------------------------------
    This seems to show ctrl_square's coefficient as significant, with p=c/n being 0.000.

    But, using ritest for ctrl_square's t-statistic:
    Code:
    ritest ctrl_square (_b[ctrl_square]/_se[ctrl_square]), reps(1000) seed(123): reg y ctrl ctrl_square x1 x2
    .
    .
    ------------------------------------------------------------------------------
    T            |     T(obs)       c       n   p=c/n   SE(p) [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           _pm_1 |  -1.632186     112    1000  0.1120  0.0100  .0931185   .1331992
    ------------------------------------------------------------------------------
    I find that p=c/n = 0.112, which is close to p=0.104 of the original regression.

    So, to check for ctrl_square's statistical significance, should I be looking at ritest for its coefficient or ritest for its t-statistic?

    Please advise.

    Thanks in advance.

    Comment


    • #3
      Sorry, I only reply now. Both are feasible options. The latter is often referred to as "studentized" RI and has some nice asymptotic properties (see e.g., https://arxiv.org/pdf/1809.07419.pdf). The studentized version makes sense especially when it seems plausible that treatment changes the variance of outcomes. In my applied work the two approaches always gave very similar results. The stark difference in your application is surprising to me. Could it be that ctrl_square is just the squared term of ctrl? This would be an odd application, since you probably should not permute the square term separately from the linear term, which seems to be what you are doing here.

      Comment


      • #4
        One query regarding ritest command. How to I get the kernel density graph which shows the marginal effects of a probit model . There is an option of wrapper given, but I am not sure of it. Can I get the code for the same?

        Comment

        Working...
        X