[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: question on cond( )

From   "Jared Gross" <>
To   <>
Subject   RE: st: question on cond( )
Date   Fri, 29 Feb 2008 09:13:02 -0500

Dear Mr. Cox,

I have tried to email the Stata list three times over the last two days and
for some reason my message hasn't gotten through.  I am emailing you because
I've noticed that you are a frequent list poster and I'm hoping that you can
either help me solve my Stata problem or forward my message to the list,
where it can be read and answered by someone else.  Thank you so much for
your help!


Please forgive my basic question; relative to most users on this list, I'm
not very familiar with Stata.

I'm trying to use the nlogit command in Stata 10 to estimate a degenerate
model of mergers and acquisitions.  Unfortunately, I keep getting the error
"no cases remain after removing invalid observations."  Because I'm pretty
sure I'm mis-specifying my model, and possibly don't have the cases right,
I'm hoping someone here can help.

My data looks like the following:

Ticker	Year 	Covariates 	GoesPrivate 	PublicTakeover 	Event

A		1999	x		0			0
0		1	
A		2000	x		0			1
1		0		
B		1998	y		0			0
0		1		
B		1999	z		0			0
0		1
B		2000	z		1			0
2		0

And the model I want to estimate is:

Company either (1) has  ContinuesIndependently == 1 OR (2) is subject to
Event == 1 | Event == 2

If Event == 1 | Event == 2, then either (A) GoesPrivate == 1 OR (B)
PublicTakeover == 1,

so that I have a nested model in which the first logit determines whether a
company continues in my data to the next year or exits through "Takeover"
(i.e. Event == 1 | Event == 2); and then a second, degenerate stage in which
the company, if Takeover == 1, either GoesPrivate == 1 or PublicTakeover ==

How do I estimate this?  I tried to use the following commands:

egen id = group(ticker)
nloitgen takeoverType = Event(Cont: 0, takeover: 1|2)
nlogit GoesPrivate covariates || takeoverType: other_covariates, base(cont)
||, case(id)

I think my problem may be coming stemming from my use of ticker as the

Thank you so much for your help.


-----Original Message-----
[] On Behalf Of Nick Cox
Sent: Friday, February 29, 2008 6:11 AM
Subject: RE: st: question on cond( )

That's a dopey example of mine. If you want to map 1 -> 1, 2 -> 2, 3 ->
3, everything else -> 4, you can 
do it more concisely. The point is just to mention nesting. 

Nick Cox

Your last question is about intention -- what was in the mind of the
program designers -- and 
is perhaps best answered by StataCorp. Oddly enough, I've never used the
four argument case that
I can recall. Although some dislike the usage, nesting of -cond(,)- lets
you handle four or more
branches, and I find that more congenial, e.g.  

cond(x == 1, 1, cond(x == 2, 2, cond(x == 3, 3, 4))) 

Naturally there are many other ways to achieve similar results. 


Visintainer, Paul


Thanks for the coding suggestions.  This is exactly what I was looking
for--especially for the multiple variables.  And, Nick (Winter), thanks
for the explanation for cond().  

One question: was it the intention of the 4-level cond() to code for
missings or is there some other application for it?

*   For searches and help try:

*   For searches and help try:

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