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: Several questions regarding xtprobit and margins command

 From Tobias Morville To statalist@hsphsun2.harvard.edu Subject Re: st: Several questions regarding xtprobit and margins command Date Tue, 13 Nov 2012 14:14:58 +0100

```Hi Nick, and again thanks. I think i figured it out.

If i did a i.Outcome, it did work, which shows that you were right.

My other problem (with constant effects) was that the default for
margins, is a linear prediction. Adding predict(pu0) solved this.

As i understand, predict(pu0) says that there is some random effect
from all subjects, and then averages that, and compares each subject
to that random effect. It does not assume away the random effects.. i
think!

But this solved my questions, and i hope that the above might help
someone with the same problem at some point.

T

2012/11/13 Nick Cox <njcoxstata@gmail.com>:
> My guess is that, although the error message may be confusing you,
> -Outcome- does not qualify as an acceptable argument for -margins-
> because, as said, it does not qualify as a factor variable or
> interaction.
>
> Nick
>
> On Tue, Nov 13, 2012 at 8:29 AM, Tobias Morville
> <tobiasmorville@gmail.com> wrote:
>> Hey Nick, and thanks for the anwser on Q#1, and the grammar correction too :-)
>>
>> I run
>>
>> -xtprobit stop_dummy Outcome outcome_lag1 seqEarn seqearn_outcome,re-
>>
>> Where seqEarn goes from 0 to approx 800 (in a very few obs). Only in
>> integers. Outcome is the number of eyes the die shows, and
>> seqearn_outcome is a interaction between seqEarn and Outcome.
>>
>>
>> As seqEarn (their accumulated earnings they get every game round) is a
>> positive monotonically increasing function of Outcome(t-z), is there
>> anything wrong with NOT adding the interactionterm between them?
>>
>
> <snip>
>
>>>> ________________________________________
>>>> From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] on behalf of Nick Cox [njcoxstata@gmail.com]
>>>> Sent: 12 November 2012 18:20
>>>> To: statalist@hsphsun2.harvard.edu
>>>> Subject: Re: st: Several questions regarding xtprobit and margins command
>>>>
>>>> I'll comment on your problem #1.
>>>>
>>>> The help for -margins- starts
>>>>
>>>> "margins [marginlist] [if] [in] [weight] [, response_options options]
>>>>
>>>>     where marginlist is a list of factor variables or interactions that appear
>>>>     in the current estimation results."
>>>>
>>>> When you give arguments immediately after the command, the crucial part is
>>>>
>>>> "margins marginlist ...
>>>>
>>>>     where marginlist is a list of factor variables or interactions that appear
>>>>     in the current estimation results."
>>>>
>>>> So, it would help if you gave the exact and complete -xtprobit-
>>>> command you used. I suspect that the error message will make sense
>>>> when we see the exact model you fitted.
>>>>
>>>> Nick
>>>>
>>>> P.S. "dice" is a strange word even to those for whom English is a
>>>> first language. "dice" is a plural: the singular is "die". One die,
>>>> two dice.
>>>>
>>>> On Mon, Nov 12, 2012 at 2:58 PM, Tobias Morville
>>>> <tobiasmorville@gmail.com> wrote:
>>>>
>>>>> I have a set of questions regarding the margins command, and marginal
>>>>> effects in general.
>>>>>
>>>>> I have a unbalanced paneldataset of 4124 observations, unevenly
>>>>> distributed on 18 subjects.
>>>>>
>>>>> My model is as follows: P(stop) = Outcome outcome_lag1 seqEarn, which
>>>>> im estimating in a RE probit setting with xtprobit command.
>>>>>
>>>>> Outcome: Outcome of a dice in period t. Lies from 1 to 6
>>>>> Outcome_lag1: Outcome of the dice in period t-1
>>>>> seqEarn: Accumulated earnings over each game. Drops to 0 if subject
>>>>> chooses to stop, or the dice shows a one. Starts at zero, and can only
>>>>> get more positive as people climb the reward ladder.
>>>>>
>>>>> All of these regressors are significant.
>>>>>
>>>>> Sooo, now the questions begin:
>>>>>
>>>>> 1) If i use -margins Outcome- (followed this guide
>>>>> http://www.stata.com/stata12/margins-plots/), then i get this
>>>>> actually is the case for all margins commands, and is my number one
>>>>>
>>>>> The only marginscommand that works, is if i use the -margins,
>>>>> dydx(Outcome outcome_lag1 seqEarn)-, which leads me to my next
>>>>> problem:
>>>>>
>>>>> 2) When i use a -margins, dydx(Outcome outcome_lag1 seqEarn)- my
>>>>> marginal effects are exactly the same as my regression coefficients?
>>>>>
>>>>> If i change the code to -margins, dydx(Outcome outcome_lag1 seqEarn)
>>>>> atmeans- they're the same again..?
>>>>> (So APE = MEM?)
>>>>>
>>>>> (http://www.stata.com/statalist/archive/2009-11/msg01517.html), which
>>>>> covers some of the questions i have, but dosen't really anwser them.
>>>>>
>>>>> If i use mfx compute, predict(pu0) they change, but they become very
>>>>> small. And im guess that pu0 means that Im setting the random effects
>>>>> slope to 9, which is a bad idea for my data, as there is quite alot of
>>>>> random variability.
>>>>>
>>>>> 3) If i choose to ignore the fact that my marginal effects are the
>>>>> same as my probit regression coefficients, then im in my next pickle.
>>>>> That my marginal effects are constant. If i plot the predicted
>>>>> probability of stopping the game, over seqEarn, its constant, which
>>>>> suits my data very badly. And im afraid that i've misunderstood
>>>>> something very basic.
>>>>>
>>>>> if i try -margins, dydx(seqEarn) at (Outcome=(2 3 4 5 6)) vsquish-
>>>>> marginal effects are the same over Outcome size...
>>>>>
>>>>> .. and it's basically the same.
>>>>>
>>>>> What i would idealy like to see, is that predicted probability changes
>>>>> both over seqEarn and over Outcome and outcome_lag1 in some systematic
>>>>> way, but right now my newbieness in Stata problemshooting is driving
>>>>> me up the wall.
>>>>>
>>>>> ------
>>>>>
>>>>> Background (just for the interested):
>>>>>
>>>>> I'm currently working with a dataset of 18 subjects, playing a virtual
>>>>> dicegame for 25 mins while in a fMRI scanner. The dice is random
>>>>> (1-6), and if you roll one, you lose whatever you accumulated this
>>>>> round. It's a balloon kind of thing: How far do people dare to go up
>>>>> the exponential reward ladder, before banking their earnings.
> *
> *   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/
```