Announcement

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

  • Easy way to fit a Rasch model in Stata

    Thanks to Kit Baum, raschify is now available on SSC.

    raschify transforms 1PL model parameters into Rasch model parameters. All the postestimation tools that are available after irt 1pl can be used on a Rasch-ified model.

    Here is an example:

    Code:
    ssc install raschify
    
    webuse masc1, clear
    irt 1pl q*
    
    // convert to Rasch parameterization
    raschify
    // display the transformed results
    irt

  • #2
    Dear Rafal,

    Thank you for your contribution.

    I am exploring the functionality of raschify and to this purpose studied the Standard dataset 3 from the Rasch org website:
    Code:
    input item1 item2 item3
    1 0 0
    0 1 1
    0 1 1
    end
    Next, I ran the IRT 1PL model, raschify and created their test information function plot, which clearly illustrate the purpose and benefit of raschify (i.e. '...in that it represents the structure which data should exhibit in order to obtain measurements from the data...' Quotation from Wikipedia).
    Code:
    * Fit a 1PL model to binary items
    irt 1pl item1-item3
    irtgraph tif, xtitle("Theta 1PL Standard Dataset 3", margin(l-0 r+0 b-2 t+2))
    * Transform the 1PL model coefficients to the Rasch metric
    raschify
    * Display parameters of the Rasch model
    irt , cformat(%9.5f)
    irtgraph tif, xtitle("Theta Rasch Standard Dataset 3", margin(l-0 r+0 b-2 t+2))
    Now, I have two questions.
    When I compare the parameters of the Rasch model, calculated by raschify, with the reference published on the Rasch org website, i.e. Pairwise Maximum Likelihood Estimation (PMLE), the column estimates are:
    .00000, -0.69315, -0.69315
    whereas from Stata/raschify these are:
    .69315, -0.69315, -0.69315
    I assume the difference is probably not substantive, but I am interested to learn why this difference occurs (e.g. is the first item 'anchored' to be 0 in the reference models?).

    My second question is if it is possible, somehow, to calculate row estimates, like those published on the Rasch org website.
    Last edited by ericmelse; 03 Aug 2018, 04:39.
    http://publicationslist.org/eric.melse

    Comment


    • #3
      Yes, in the example on the Rasch website, the first item is anchored at 0. You can replicate their estimates in Stata using gsem, however you will not be able to use irtgraph afterwards.

      Code:
      clear
      input item1 item2 item3
      1 0 0
      0 1 1
      0 1 1
      end
      
      irt 1pl *
      raschify
      irt
      Note that the underlying model is fit by gsem:

      Code:
      di e(cmdline2)
      gsem (Theta@a1 -> item1 item2 item3, logit)   , variance(Theta@1) latent(Theta) constraints( )
      See how the coefficients are labeled:
      Code:
      gsem, coeflegend
      ------------------------------------------------------------------------------
                   |      Coef.  Legend
      -------------+----------------------------------------------------------------
      item1        |
             Theta |          1  _b[item1:Theta]
             _cons |  -.6931471  _b[item1:_cons]
      -------------+----------------------------------------------------------------
      item2        |
             Theta |          1  _b[item2:Theta]
             _cons |   .6931471  _b[item2:_cons]
      -------------+----------------------------------------------------------------
      item3        |
             Theta |          1  _b[item3:Theta]
             _cons |   .6931471  _b[item3:_cons]
      -------------+----------------------------------------------------------------
         var(Theta)|   3.67e-15  _b[/var(Theta)]
      ------------------------------------------------------------------------------
      Constrain the difficulty of item1 to 0 and run the model using gsem massaging the syntax to fit a Rasch model:

      Code:
      constraint 1 _b[item1:_cons] = 0
      gsem (Theta@1 -> item1 item2 item3, logit), latent(Theta)  constraints(1)
      ------------------------------------------------------------------------------
                   |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      item1        |
             Theta |          1  (constrained)
             _cons |          0  (omitted)
      -------------+----------------------------------------------------------------
      item2        |
             Theta |          1  (constrained)
             _cons |   .6931472   1.224745     0.57   0.571    -1.707309    3.093603
      -------------+----------------------------------------------------------------
      item3        |
             Theta |          1  (constrained)
             _cons |   .6931472   1.224745     0.57   0.571    -1.707309    3.093603
      -------------+----------------------------------------------------------------
         var(Theta)|   2.63e-35   1.20e-17                             .           .
      ------------------------------------------------------------------------------
      Note that the model is fit using the slope-intercept form, a'*Theta + b'. If we were able to use irt to display these gsem estimates, we would see a = a' and b = -b'/a, which would match the coefficients on the Rasch website.

      Alternatively, reverse the item coding to match the estimates without the need of a transformation:

      Code:
      recode item* (1=0) (0=1)
      constraint 1 _b[item1:_cons] = 0
      gsem (Theta@1 -> item1 item2 item3, logit), latent(Theta)  constraints(1)
      ------------------------------------------------------------------------------
                   |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      item1        |
             Theta |          1  (constrained)
             _cons |          0  (omitted)
      -------------+----------------------------------------------------------------
      item2        |
             Theta |          1  (constrained)
             _cons |  -.6928628   1.224687    -0.57   0.572    -3.093205    1.707479
      -------------+----------------------------------------------------------------
      item3        |
             Theta |          1  (constrained)
             _cons |  -.6928628   1.224687    -0.57   0.572    -3.093205    1.707479
      -------------+----------------------------------------------------------------
         var(Theta)|   3.57e-34   5.39e-17                             .           .
      ------------------------------------------------------------------------------
      I suspect it is possible to calculate row estimates in Stata using AMLE or WMLE, however that would require further programming.

      Comment

      Working...
      X