Announcement

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

  • ssc cortesti

    I was wondering if any others agree that the Williams test implemented in the SSC program cortesti might have a coding error?

    Code:
      local detR=(1-`rxy'^2-`ryv'^2-`rxv'^2+2*`rxy'*`rxv'*`ryv')
      local diffr=`rxy'-`ryv'
      local tnum=(`n'-1)*(1+`rxv')
      local tden=2*((`n'-1)/(`n'-3))*`detR'+0.5*(`rxy'+`ryv')*(((1-`rxv')^3))
      local t=`diffr'*sqrt(`tnum'/`tden')
    Maybe the fourth line should be:

    Code:
      local detR=(1-`rxy'^2-`ryv'^2-`rxv'^2+2*`rxy'*`rxv'*`ryv')
      local diffr=`rxy'-`ryv'
      local tnum=(`n'-1)*(1+`rxv')
      local tden=2*((`n'-1)/(`n'-3))*`detR'+(0.5*(`rxy'+`ryv'))^2*(((1-`rxv')^3))
      local t=`diffr'*sqrt(`tnum'/`tden')
    Some online references about the formula are:

    https://cran.r-project.org/web/packages/cocor/cocor.pdf

    pages 14,15
    Last edited by Dave Airey; 09 Apr 2019, 07:42.

  • #2
    Hi Dave. I don't know if this will help, but here is some SPSS code I wrote to carry out the Williams (1959) test. In SPSS syntax, # indicates a temporary (or scratch) variable, and ** is the exponentiation operator. Everything else is probably fairly clear.

    Code:
    COMPUTE #R = (1 - r12**2 - r13**2 - r23**2) + 2*r12*r13*r23.
    COMPUTE diff = r12 - r13.
    COMPUTE #part1 = (n-1)*(1+r23).
    COMPUTE #part2 = 2*((n-1)/(n-3))*#R.
    COMPUTE #part3 = ((r12+r13)**2/4)*(1-r23)**3.
    COMPUTE t = diff * SQRT(#part1 / (#part2 + #part3)).
    COMPUTE df = n-3.
    COMPUTE #tneg = 0 - abs(t).
    COMPUTE p = cdf.t(#tneg,df)*2.
    The full syntax file is syntax file #6 on this page. The equation we worked from was this one in David Howell's book Statistical Methods for Psychology. I hope this helps you work out what's going on.

    Cheers,
    Bruce
    --
    Bruce Weaver
    Email: [email protected]
    Web: http://sites.google.com/a/lakeheadu.ca/bweaver/
    Version: Stata/MP 18.0 (Windows)

    Comment


    • #3
      Concerning cortesti, I do not see any explicit reference to Williams (1959) in the help file or in the code; the reference given is Cohen and Cohen (1983) but unfortunately there is no reference to a specific page or formula in that book. Thus, I find it hard to judge for sure whether there is a coding error or whether the original author of cortesti was implementing a different (perhaps erroneous) method/formula.

      I have no experience in this field but the code that Bruce provides in #2 seems to be consistent with the changes that David suggests in #1. If I were David, I would either contact the author of cortesti (although the code is pretty old) and/or just go ahead and implement my own code.

      Best
      Daniel


      Cohen J., & Cohen P. 1983. Applied Multiple Regression/Correlation Analysis for the Behavioral Sciences. Hillsdale, NJ: Lawrence Erlbaum Associates (2nd Ed).
      Williams, E. J. 1959. The comparison of regression variables. Journal of the Royal Statistical Society, Series B, 21(2), 396-399.

      Comment


      • #4
        Thanks for the replies. Bruce's code is consistent with what I was thinking. The cocor package help on pages 14-15 also is quite detailed. I won't use cortesti. Cheers, Dave.

        Comment

        Working...
        X