Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: St:Selecting observations


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: St:Selecting observations
Date   Sat, 8 Jan 2005 14:44:35 -0000

I haven't tried to understand your Stata 
code, because from your word specification
the problem seems to yield to a direct climb 
up the North Face. 

There will be as many regressions as observations. 
I am not clear if your -Id- is equal 
to your observation numbers, but we can go 

forval i = 1/`=_N' { 	
	regress <varlist> if _n != `i' & Country == Country[`i'] 
	<do something with results>
} 

However, your various regressions are highly dependent 
within countries, which will be problematic for 
some purposes. Whether your approach is correct 
I cannot judge without knowing how you intend 
to use the results. 

Nick 
[email protected] 

Apostolos Ballas
 
> I am interested to do a statistical analysis repeteadly for a 
> number of
> companies. The observations are organized as follows:
> 
> Country 	Id	Numerical Data
> UK		1
> UK		2
> UK		3
> .
> .
> .
> France		101
> France		102
> .
> 
> and so on for other EU countries.
> 
> I want to run a regression from which I will exclude company 
> X but use data
> from all other companies in the same country. My solution is 
> as follows:
> 
> gen byte iscountry=0
> sort id year
> gen obs=_n
> by id: gen obs_no=_n
> by id: gen obs_lot=_N
> sort obs_no id
> gen comp_no=_n if obs_no==1
> sort obs
> replace comp_no=comp_no[_n-1] if comp_no >=.
> forval i=1/1302 {
> replace iscountry=0
> replace iscountry=1 if comp_no==`i'
> bysort country (iscountry): replace iscountry = iscountry[_N]
> sureg .......          if comp_no!=`i' & iscountry==1, robust
> }
> 
> Is this the best possible approach? Indeed, is it a correct approach?
> 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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