Announcement

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

  • Discrepancy for Shapiro-Wilks value between Stata (v15) vs. SPSS 26 and JASP 15.

    Hello,

    This is an unusual question as it involves statistical platforms outside of Stata. I'm teaching a statistics class and am producing labs in Stata but permitting students to complete them in SPSS or JASP (my institution doesn't have a campus-wide license). While there are some discrepancies across platforms I can usually figure out what is producing it, but I'm running into an issue where the differences are quite sizeable.

    Code:
    Stata v15 
    swilk ABANDON 
                       Shapiro-Wilk W test for normal data 
        Variable |        Obs       W           V         z       Prob>z 
    -------------+------------------------------------------------------ 
         ABANDON |      1,487    0.99971      0.258    -3.406    0.99967 
    
    SPSS v26 
                       Shapiro-Wilk W test for normal data 
        Variable |        Obs       W           V         z       Prob>z 
    -------------+------------------------------------------------------         unlabelled statistic is 0.898904
         ABANDON |      1,487      ???         ???     -3.406    0.99967 
    
    JASP v15 
                       Shapiro-Wilk W test for normal data 
        Variable |        Obs       W           V         z       Prob>z 
    -------------+------------------------------------------------------         unlabelled statistic is 0.898904
         ABANDON |      1,487      ???         ???     -3.406    0.99967
    The z-values produced, which I determined from the listed p-values in their respective programs, were identical. But the test statistics are neither W nor V.

    Does anyone have any insight into what SPSS and JASP are reporting in this case - or alternatively, whether Stata is using a unique formula for the normality test?

    Cheers,

    David.

  • #2
    forum software bug -- duplicated post
    Last edited by daniel klein; 04 Sep 2022, 22:17. Reason: forum software bug -- duplicated post

    Comment


    • #3
      I cannot answer your question. You can see what Stata computes in detail by typing

      Code:
      viewsource swilk.ado
      You can compare that to JASP (which seems to be build upon R).
      Last edited by daniel klein; 04 Sep 2022, 22:20.

      Comment


      • #4
        Thanks for the suggestion Daniel, I'll check it out! I think my issue though will be reading the R code, as I don't use that program....

        Comment


        • #5
          Originally posted by David Speed View Post
          I think my issue though will be reading the R code, as I don't use that program....
          Me neither. However, the code isn't even written R; it's implemented in C (appears to be "translated" from FORTRAN).

          I might play around with the data a bit, first, to get a better feeling for the condions (if any) under which Stata agrees with R and those under which it does not.

          Comment


          • #6
            The Shapiro-Wilk test was an enormous contribution in its time, but even 40 years ago its original limitation to very small sample sizes was being noticed, and various approximations for larger sample sizes were explored, notably by Patrick Royston, who in turn made massive contributions to Stata. It's the small print of what is done for your sample size that likely varies from program to program.

            That said, I don't know how you get P-values that large unless you are simulating normal data to start with!

            Comment


            • #7
              Hi Everyone,

              I figured it out - Stata defaults to using ties for ranked values, while SPSS and JASP automatically do not. Specifying this in Stata
              Code:
              swilk var, noties
              will produce equivalent results.

              Good eye Nick Cox! It was indeed synthetic data.

              Cheers,

              David.

              Comment

              Working...
              X