Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Random permutation test for rank-dependence

 From Tobias Morville To statalist@hsphsun2.harvard.edu Subject Re: st: Random permutation test for rank-dependence Date Tue, 29 Jan 2013 16:35:35 +0100

```Hi again, and thanks for the swift reply.

I've checked the help <progname> postestimation with rigor, but often
find myself more confused, or further from what i want to do.

Coeffcients would be different over subjects, because they are indeed
random, And i am also looking at interaction effects.

I have to admit that i don't really get your "change and further
controll variables to 0", and i since i can't argue for fixed effects,
why would i want to use a mixed-model? Further, when looking at the
options for -predict-, i dont see anything similair or remotely close
to -reffects-? (I've googled it too)

Mabye some lignt background information is in order.

My model is a binary choice model of continue (=0), or stop (=1)
(which is the stop_dummy). I am researching data on a gambling task,
where people see a dice, and what they've earned so far (which is
seqEarn). This die (which i will refer to as Outcome) is randomly
distributed (i.e. 1/6 prob. of each outcome), but comes up significant
when i do -xtprobit stop_dummy seqEarn Outcome, re-.

When i do this on individual level, Outcome comes out significant with
different slopes - both in magnitude and in sign - over different
subjects. But because my model is non-linear, I need some measure of
the ordinality of the effect of the die - i.e. i need the parameter
estimates of Outcome, over all subjects, by each round.

When i have this, i hope to do a permutation of Outcome, and then
compare the results from that permutation to my actual model. In that
way, hopefully, ill be able to say something about the ordinality of
the effect of Outcome. Both with-in Subjects, and across Subjects..

Hope this helps in seeing what i want to do.

The ultimate goal of this, is to use the parameter estimates (aka
coefficients), as a weight in fMRI analysis.

best,
Tobias

2013/1/29 Maarten Buis <maartenlbuis@gmail.com>:
> That is incorrect, it very much depends on the exact model and how you
> use -predict-. The options available to you are typically documented
> in -help <progname>_postestimation-, where <progname> is the name of
> the program you used to estimate your model. So in your case it would
> be -help xtprobit_postestimation-.
>
> Your first step would be the specify why coefficients would be
> different across persons: is it because of interaction effects or
> because they are random? In both cases -predict- can give you what you
> ask for. For the former I would (temporarily) change and further
> controll variables to 0 and use predict with the -xb- option. For the
> latter, you could use -xtmelogit- instead and afterwards use the
> -reffects- option for -predict-.
>
> -- Maarten
>
> On Tue, Jan 29, 2013 at 3:05 PM, Tobias Morville
> <tobiasmorville@gmail.com> wrote:
>> Hi Maarten. Yes i did.
>>
>> If i understand it correctly, -predict- gives me the predicted values
>> (and se.) for the entire model, and not the parameter values of the
>> regressors.
>>
>> 2013/1/29 Maarten Buis <maartenlbuis@gmail.com>:
>>> Did you take a look at -predict-?
>>>
>>> On Tue, Jan 29, 2013 at 9:36 AM, Tobias Morville wrote:
>>>> Hi Nick. Thanks for pointing out the -permute- command, don't know how
>>>> i've missed it.
>>>>
>>>> Im still on bare ground with regard to Q1. If anyone has any input,
>>>> ill appriciate it.
>>>>
>>>> best,
>>>> Tobias
>>>>
>>>> 2013/1/28 Nick Cox <njcoxstata@gmail.com>:
>>>>> I haven't tried to understand all this, but your opening to Q2 is
>>>>> incomplete. Stata has a -permute- command that transcends the specific
>>>>> oldstyle testing commands you mention.
>>>>>
>>>>> I won't be able to add more, but if you overlooked that, you probably
>>>>> overlooked other things too.
>>>>>
>>>>> Nick
>>>>>
>>>>> On Mon, Jan 28, 2013 at 5:23 PM, Tobias Morville
>>>>> <tobiasmorville@gmail.com> wrote:
>>>>>
>>>>>> i have a question regarding random permutation testing in stata.
>>>>>>
>>>>>> I need to test for rank-dependence and sign-dependence, over several
>>>>>> variables within each subject, and across subjects. Doing that i have
>>>>>> two basic questions. But first, this is the (simplified) model I'm
>>>>>> estimating:
>>>>>>
>>>>>>  Model: -xtprobit dummy var1 var2 var3 var1*var2 var1*var3, re-
>>>>>>
>>>>>> And I'm doing this for 18 different subjects, that each have ~250
>>>>>> observations. They are all stacked onto each other, in one dataset.
>>>>>>
>>>>>> Q1: How [...] do i add parameter coefficients as new
>>>>>> variables? I've googled this, and stumbled upon -estimates- module and
>>>>>> -statsby-. But none of them really satisfy my needs.
>>>>>>
>>>>>> What i really want, is a new variable (in a column) where parameter
>>>>>> estimates are continuously reported to. Lets say subject_1 has 250
>>>>>> trials, then I want 250 values of b1 - which i assume is the parameter
>>>>>> coefficient of var1 - to be my new variable. And so forth with all the
>>>>>> other subjects, resulting in my new b1-parameter-value-variable having
>>>>>> 18*~250 observations.
>>>>>>
>>>>>> I've done, -Estimates store- just produces b1 b2 b3 b4 b5, a "group
>>>>>> level" coefficient for each of the variables (and interaction terms),
>>>>>> which is not really satisfying for my need when wanting to do a random
>>>>>> permutation test.
>>>>>>
>>>>>> Q2: For the random permutation test, stata has two non-parametric
>>>>>> choices. -Ranksum- and -Median-, where the first only allows testing
>>>>>> between two groups and the latter is an equility-of-median test, which
>>>>>> is not really useful for me.
>>>>>>
>>>>>> Basically i would like to do a -ranksum- test, but between all 18
>>>>>> subjects, which ranksum does not allow. Is there any alternative way
>>>>>> of doing this?
>>>>>>
>>>>>> Background:
>>>>>>
>>>>>> I have a variable that is randomly distributed (it's a die) and i want
>>>>>> to see if the number of eyes on that die affects how people gamble.
>>>>>> When i include it as a simple regressor, it shows up significant. But
>>>>>> not knowing if that (not logical - a rational agent should know its
>>>>>> random) weigh on the die, is the same across subjects, and within each
>>>>>> subject. Basically, i want to be able to say something about "how
>>>>>> much" the die weights for different subjects, but because its
>>>>>> non-linear, i can't compare a coefficient value of 2 to 4, and say its
>>>>>> the double effect. Neither can i say that subject 1's coefficient of
>>>>>> 5, is a lower effect of subject 2's coefficient of 7. And i need to
>>>>>> find out, if i can at least, say something about the rank of the
>>>>>> coefficient estimates.
>>>>>>
>>>>>> Hope you can help me out as I'm rather lost!
>>>>> *
>>>>> *   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/
>>>
>>>
>>>
>>> --
>>> ---------------------------------
>>> Maarten L. Buis
>>> WZB
>>> Reichpietschufer 50
>>> 10785 Berlin
>>> Germany
>>>
>>> http://www.maartenbuis.nl
>>> ---------------------------------
>>> *
>>> *   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/
>
>
>
> --
> ---------------------------------
> Maarten L. Buis
> WZB
> Reichpietschufer 50
> 10785 Berlin
> Germany
>
> http://www.maartenbuis.nl
> ---------------------------------
> *
> *   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/
```