pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: asymptotic standard error of lambda


From: Ben Pfaff
Subject: Re: asymptotic standard error of lambda
Date: Mon, 5 May 2014 08:09:16 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

I'm sure there is an error in our implementation.  NaN is coming from
the square root of a negative number, as you said.

I made another mistake below.  PSPP actually calculates ASE0 correctly
for asymmetric lambda (lambda divided by ASE0 is what's displayed as
"Approx. T", which matches that calculated by SPSS for asymmetric
lambda).  It's ASE1, displayed as "Asymp. Std. Error", that PSPP gets
wrong.

One oddity of the formula for ASE1 is that it appears to use both
symmetric and asymmetric lambda in the formula; that is, one use of
lambda in the formula lacks the Y|X subscript.  I've tried treating it
as written and as if the Y|X subscript were there (the latter seems more
reasonable), but I don't get the SPSS calculated ASE1 value either way.

Here's my calculation of ASE1 for the example data quoted below.

f_ij with totals =
        424     213     59      | 696
        55      188     357     | 600
        ------------------------+----
        479     401     416     | 1296

c_m = 479

W = 1296

delta_ij =
        1       0       0
        0       0       1

delta_j =
        1       0       0
        1       0       0

lambda_Y|X = .370

sum(i=1...R)sum(j=1...C)(f_ij(delta_ij - delta_j + lambda_Y|X delta_j)^2 =
          424(1 - 1 + lambda)^2 + 213(0 - 0 + 0)^2 + 59(0 - 0 + 0)^2
        + 55(0 - 1 + lambda)^2 + 188(0 - 0 + 0)^2 + 357(1 - 0 + 0)^2
        = 424 lambda^2 + 55(lambda - 1)^2 + 357
        = 479 lambda^2 - 110 lambda + 412

ASE1 = sqrt(479 lambda^2 - 110 lambda + 412 - 1296 lambda) / (1296 - 479)
     = sqrt(-42.6449) / 817

so that's where I get sqrt(negative).  Using symmetric lambda in place
of lambda_Y|X in the big sum also gives sqrt(negative), so that doesn't
seem to be the key.

What am I doing wrong?

On Mon, May 05, 2014 at 10:22:21AM +0200, John Darrington wrote:
> I did a quick (ish) calculation on paper and the first ASE came out to be 
> 0.0394 
> which is not too far from what your reference says,  so perhaps there is an 
> error in 
> our implementation.
> 
> From where is NaN coming?  Presumamble it must be as a result of taking the 
> square root
> of a negative number.  This should give us a hint of the problem.
> 
> J'
> 
> On Sun, May 04, 2014 at 09:59:15PM -0700, Ben Pfaff wrote:
>      The CROSSTABS command can compute Goodman and Kruskal's lambda.  It also
>      calculates the standard error of lambda according to the formula for
>      ASE0 given here:
>      
> http://pic.dhe.ibm.com/infocenter/spssstat/v22r0m0/index.jsp?topic=%2Fcom.ibm.spss.statistics.algorithms%2Falg_crosstabs_measures.htm
>      
>      This page gives an example of the SPSS calculation:
>      
> http://www.csupomona.edu/~jlkorey/POWERMUTT/Topics/contingency_tables.html
>      
>      Here is PSPP syntax that should reproduce the given on that page:
>      
>      SET FORMAT F8.3.
>      
>      * From 
> http://www.csupomona.edu/~jlkorey/POWERMUTT/Topics/contingency_tables.html.
>      DATA LIST LIST NOTABLE/x y w.
>      WEIGHT BY w.
>      BEGIN DATA.
>      1 1 424
>      1 2 213
>      1 3 59
>      3 1 55
>      3 2 188
>      3 3 357
>      END DATA.
>      
>      Directional measures.
>      
> #========================================#=====#===========#========#=========#
>      #Category      Statistic       Type      #Value|Asymp. Std.| Approx.|  
> Approx.#
>      #                                        #     |      Error|       T|    
>  Sig.#
>      
> #----------------------------------------#-----+-----------+--------+---------#
>      #Nominal by    Lambda          Symmetric # .423|       .021|  15.281|    
>      #
>      #Nominal                                 #     |           |        |    
>      #
>      #                              x         # .497|        NaN|  15.986|    
>      #
>      #                              Dependent #     |           |        |    
>      #
>      #                              y         # .370|        NaN|  16.339|    
>      #
>      #                              Dependent #     |           |        |    
>      #
>      #             
> ---------------------------#-----+-----------+--------+---------#
>      #              Goodman and     x         # .382|           |        |    
>      #
>      #              Kruskal tau     Dependent #     |           |        |    
>      #
>      #                              y         # .198|           |        |    
>      #
>      #                              Dependent #     |           |        |    
>      #
>      
> #========================================#=====#===========#========#=========#
>      
>      However, the asymmetrics ASEs given above are wrong.  The first NaN
>      should be .024 and the second one should be .020 according to that
>      example webpage.
>      
>      Worse, the ASEs given above don't match those calculated by other
>      software.  For example, if you enter the data above into
>      http://vassarstats.net/newcs.html, you get the same lambda values .497
>      and .370 (well, to one extra digit), but ASEs .034 and .028,
>      respectively.
>      
>      Can anyone explain how to calculate the asymptotic standard error of
>      lambda in a way that matches the SPSS results?
>      
>      _______________________________________________
>      pspp-dev mailing list
>      address@hidden
>      https://lists.gnu.org/mailman/listinfo/pspp-dev
> 
> -- 
> PGP Public key ID: 1024D/2DE827B3 
> fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
> See http://sks-keyservers.net or any PGP keyserver for public key.
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]