Statalist


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

Re: st: matrix question


From   Tirthankar Chakravarty <[email protected]>
To   [email protected]
Subject   Re: st: matrix question
Date   Sat, 8 Aug 2009 17:54:51 +0100

<>
By the by, is there a reason you are skipping every other variable
(forval o=2(2)`t')? Note that the dimensions of the matrix that will
result due to this procedure will be [kx3] where k is half the number
of variables in `rest', i.e., the total number of variables less one.

T

On Sat, Aug 8, 2009 at 5:27 PM, Tirthankar
Chakravarty<[email protected]> wrote:
> <>
>
> Does this work? The example is a little facetious, as all the
> variables are always positive.
> ****************************
> clear*
> cap  prog drop bif_des
> program bif_des
>        cap drop _*
>        quietly des,varlist
>        tokenize `r(varlist)'
>        local first `1'
>        macro shift
>        local rest `*'
>        local t: word count `rest'
>        local colnames
>        tokenize `rest'
>        forval o=2(2)`t' {
>               local colnames `colnames' ``o''
>               gen _``o''pos=1 if (``o''>0 & ``o''!=.)
>               replace _``o''pos=0 if (``o''<0)
>               estpost tab _``o''pos, mi
>               matrix def o=e(pct)
>               matrix def l=e(cumpct)
>               mat A=(nullmat(A),(o[1,1..2],l[1,2])')
>               }
>        mat colnames A = `colnames'
>        mat list A
> end
> sysuse auto, clear
> bif_des
> ****************************
>
> T
>
> On Sat, Aug 8, 2009 at 4:59 PM, moleps islon<[email protected]> wrote:
>> That is exactly what I'm looking for, however applying your code to my
>> program doesnt work ( though your code works beautifully). I end up
>> with r503 conformability error. And also instead of a [8,4] matrix I
>> get a [1,24] matrix.
>>
>> Moleps
>>
>>
>> capture  program drop  bif_des
>> program bif_des
>> capture drop _*
>> quietly des,varlist
>>
>> local r `r(varlist)'
>> di "`r'"
>> tokenize `r'
>> local first `1'
>> macro shift
>> local rest `*'
>>
>> local t:word count `rest'
>>
>> tokenize `rest'
>> forval o=2(2)`t' {
>>
>>       local rowname `rowname' ``o''
>>       gen _``o''pos=1 if (``o''>0 & ``o''<.)
>>       replace _``o''pos=0 if (``o''<0)
>>       estpost tab _``o''pos,mi
>>       matrix def o=e(pct)
>>       matrix def l=e(cumpct)
>>       mat A=(nullmat(A),(o[1,1..2],l[1,2])')
>>       mat list A
>>       }
>> mat rownames A = `rowname'
>>
>> end
>> *
>> *   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/
>>
>
>
>
> --
> To every ω-consistent recursive class κ of formulae there correspond
> recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
> belongs to Flg(κ) (where v is the free variable of r).
>



-- 
To every ω-consistent recursive class κ of formulae there correspond
recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
belongs to Flg(κ) (where v is the free variable of r).

*
*   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/



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