Bookmark and Share

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


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

Re: st: set value to zero in a Matrix


From   Jörg Eulenberger <j.eulenberger@web.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: set value to zero in a Matrix
Date   Tue, 05 Mar 2013 13:53:36 +0100

Dear Nick,
thanks a lot for the answer, but the result of the code

use "http://www.ats.ucla.edu/stat/stata/output/m255";, clear
factor item13-item24, pcf
rotate, varimax horst blanks(.4)
matrix list e(r_L)
matrix a = e(r_L)
mata :
for(i = 1; i <= rows(a); i++) {
         for(j = 1; j <= cols(a); j++) {
                 if (a[i,j] < 0.4) a[i,j] = 0
         }
}
end


are:

 <istmt>:  3499  a not found
(0 lines skipped)
---------------------------------------------------------------------------------------------------------------------
r(3499);

end of do-file

r(3499);

My problem is not a esttab problem. I want to change a matrix (after
rotate):

Thanks,
Jörg






Am 05.03.2013 13:47, schrieb Nick Cox:
> One possibility is that you are going to need an e-class program that
> emits a changed matrix.
>
> I don't use -esttab- (SSC) so can't advise. (Please remember to
> explain where user-written programs come from.)
>
> As I don't really approve I am not volunteering!
>
> Nick
>
> P.S. At worst this is a nested loop, e.g.
>
> mata :
> y = runiform(5,5)
>
> for(i = 1; i <= rows(y); i++) {
>          for(j = 1; j <= cols(y); j++) {
>                  if (y[i,j] < 0.1) y[i,j] = 0
>          }
> }
>
> y
> end
>
>
> On Tue, Mar 5, 2013 at 12:22 PM, Jörg Eulenberger <j.eulenberger@web.de> wrote:
>
>> i have a problem with matrix.
>> After a factor analysis i want tabulate the results (varimax with
>> blanks) with esttab.
>> But the Matrix "e(r_L)" include all value.  For esttab, i want set the
>> value smaller than .04 to zero (like the blanks-subcommand).
>> i found functions like mm_cond and mf_editvalue but nothing works.
>>
>> Any suggestions?
>>
>> **********
>> use "http://www.ats.ucla.edu/stat/stata/output/m255";, clear
>> factor item13-item24, pcf
>> rotate, varimax horst blanks(.4)
>> matrix list e(r_L)
>> esttab, cells("r_L[1](t label(Factor 1)) r_L[2](t label(Factor 2))")
>> nogap noobs nonumber nomtitle label
>>
>> ******************
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
>

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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index