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: Problem with decile significance test


From   Xixi Lin <winnielxx@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Problem with decile significance test
Date   Mon, 11 Mar 2013 15:53:24 -0400

Hi Nick,

What I am trying to do is to create deciles for dependent variable
according to independent variables (or sorted by independent
variables), that is how the d_`x' are created. For example, d_X1 is
the decile for dependent variable( Return) sorted by X1.

Then, I want to test for each decile, whether decile=1 is larger than decile=10.

Best,
Xixi Lin

On Mon, Mar 11, 2013 at 3:42 PM, Nick Cox <njcoxstata@gmail.com> wrote:
> I don't know exactly what you are trying to do here, but the nub of
> the matter may be that
>
> observations for which -Return1- is calculated, namely
>
> if d_`x'==1 & Period==`z'
>
> and for which -Return2- is calculate, namely
>
> if d_`x'==10 & Period==`z'
>
> must be separate observations because it can't be true that something
> is both 1 and 10.
>
> Hence, as you report,
>
>             ttest Return1=Return2 if Period==`z'
>
> finds no observations.
>
> Nick
>
> On Mon, Mar 11, 2013 at 7:33 PM, Xixi Lin <winnielxx@gmail.com> wrote:
>> Hi,
>>
>> I am trying to do decile significance test, however my codes does not
>> work, can anyone help me to debug it?
>>
>> Here is my code:
>> //create deciles according to independent variables
>> sort X1
>> by X1: gen d_X1=ceil(_n*10/_N)
>>
>> foreach x of numlist 2/120 {
>>         replace d_X1=ceil(_n*10/_N) if Period==`x'
>> }
>> *****repeat the above code for each  independent variable
>>
>> //t statistics
>> foreach x in X1 X2 X3 X4 X5 {
>>        gen Return1_`x'=.
>>            gen Return2_`x'=.
>> foreach z of numlist 2/120 {
>>        replace Return1_`x'=Return if d_`x'==1 & Period==`z'
>>            replace Return2_`x'=Return if d_`x'==10 & Period==`z'
>>            ttest Return1=Return2 if Period==`z'
>>            display "`x'" "Period " "`z'" `r(p)'
>>       }
>>    }
>>  ****it would be better if I can display p value for T>t not
>> |T|>|t|******Anyone knows how to display that?
>>
>> The stata shows that "no observations". Does anyone know what is wrong
>> with my code?
> *
> *   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