Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Kwallis in a loop [now p-value of the Kwallis]

From   "Nick Cox" <>
To   <>
Subject   RE: st: Kwallis in a loop [now p-value of the Kwallis]
Date   Sun, 13 Nov 2005 17:24:03 -0000

Your answer strengthens my previous argument.

-makematrix- just cannot fulfil all the expectations
you have of it. If you omit the spaces in 

max(chiprob(r(df), r(chi2_adj) + 1e-20),.0001) 



you might get -makematrix- to behave the way you want, 
as the argument of -from()- is parsed on spaces, 
but you are still ignoring my strong advice not to do it
this way. 

I am at a loss to see why you prefer this route to 
that of a program designed to tackle your problem 
directly. No programming on your part is required. 


> Dear Nick:
> Sorry for this late reply. I tried your program and it works 
> perfectly. I thank you very much.
> Although I perfectly read what you wrote about -makematrix-, 
> I still like this command and my level of programming is not 
> good enough to write the program you designed for me.
> So, I would have an additional question, hopefully more simple.
> With a ranksum test, I learnt from prior postings how to get a matrix:
> makematrix m1, from(r(z) 2*normprob(-abs(r(z)))) label : 
> ranksum prov_ass, by( sodas2cl)
> I woud like to do the same with -kwallis-. In your program, I 
> found the following formula which seems to be the computation 
> of the p-value of the kwallis: 
> max(chiprob(r(df), r(chi2_adj) + 1e-20),.0001) 
> Then, I wrote the following command with -makematrix-: 
> makematrix m2, from(r(chi2_adj)   max(chiprob(r(df), 
> r(chi2_adj) + 1e-20),.0001) ) label : kwallis prov_ass, by(sodas3cl)
> Unfortunately, it does not work. I get the following error message:
> invalid '.0001' 
> r(198);
> I obviously did something wrong.

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index