Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: RE: How to implement ranktest of matrix

 From Austin Nichols To statalist@hsphsun2.harvard.edu Subject Re: st: RE: How to implement ranktest of matrix Date Thu, 8 Jul 2010 08:28:58 -0400

```Mark--
The poster might have wanted a statistical test of the rank of the dgp
of the matrix (or a comparison of the two matrices), which is what
-ranktest- does, right?  But how can an N by 1 matrix have rank
greater than 1?

On Wed, Jul 7, 2010 at 7:39 PM, Schaffer, Mark E <M.E.Schaffer@hw.ac.uk> wrote:
> Komi,
>
>> -----Original Message-----
>> From: owner-statalist@hsphsun2.harvard.edu
>> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of
>> Komi Agbemavi Mati
>> Sent: 07 July 2010 20:43
>> To: statalist@hsphsun2.harvard.edu
>> Subject: st: How to implement ranktest of matrix
>>
>> I  need to test whether the following matrix have rank 0, 1
>> or 2. I am trying to use     ranktest in stata but i don't
>> know what to put in Y and what
>>  to put in Z as described in the help file.
>>
>>                                    dqdZ1           dqdz2
>>                                 .0002178      .0000277
>>                                  .0003644      .0000637
>>                                .0022189     -.0004827
>>                                .0012441      .0000804
>>                                -.0182371    -.0013471
>>                                .0026022      .0008305
>>
>>  When I try the following command
>>  ranktest  dqdZ1        dqdz2,
>
> If you want to know the rank of a Stata matrix like the one above, you
> can use, say, the Mata function rank() (see help mf_rank).  You would
> move the matrix from Stata into Mata and then use the rank() function.
>
> -ranktest- is different.  (Mea culpa - on re-reading the help file, I
> think this could be clearer.)  It is for testing the rank of a matrix of
> correlations or regression parameters.
>
> When you say
>
> ranktest dqdZ1 dqdz2
>
> what is happening is basically the same thing as regressing dqdZ1 on
> dqdz2 and testing whether the regression parameter is nonzero (i.e.,
> rank>0).  I suspect this isn't what you want, and instead you want the
> rank of the Stata matrix above, but perhaps I'm wrong here.
>
> Hope this helps.
>
> Cheers,
> Mark
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```