Statalist


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

Re: st: OLS regression in STATA - missings


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   Re: st: OLS regression in STATA - missings
Date   Sun, 5 Oct 2008 15:44:12 +0200

In principle, what you are asking Stata to do is not impossible


***********
webuse nlswork, clear
generate age2 = age^2
generate ttl_exp2 = ttl_exp^2
generate tenure2 = tenure^2
generate byte black = race==2
xtset idcode

levelsof(year), loc(levyear)
foreach lev of loc levyear{
reg ln_w grade age* ttl_exp* tenure* black not_smsa south if year<=`lev', robust cluster( birth_yr)
}
***********


We do not customarily question your intentions on the list, but why do you want this kind of regression? Why not use -xtreg- (which supplied the example above)?

BTW, the fact that the -reg- command runs w/o a hitch in the absence of the -if- qualifier suggests to me that you have not -destring-ed your years? Let me guess: you imported them from somewhere and forgot to make them amenable for Stata...


HTH
Martin
_______________________
----- Original Message ----- From: "Bastian Steingros" <[email protected]>
To: <[email protected]>
Sent: Sunday, October 05, 2008 3:30 PM
Subject: Re: st: OLS regression in STATA - missings



Dear Joao Lima

tsset etc. have already been done.

The point is, that regressions without *year<=`i'* run without any problems. That is:
reg dep_var indep var..., robust cluster (firms)
(I think this case is named pooled cross sectional regression or something)

Bastian

-------- Original-Nachricht --------

Datum: Sun, 5 Oct 2008 09:36:00 -0300
Von: "Joao Ricardo F. Lima" <[email protected]>
An: [email protected]
Betreff: Re: st: OLS regression in STATA - missings

Dear Bastian,

is this a time series? What is the range? Do you tsset the data?
Before use the looping, you need to see if the command run. This
command run?

reg dependent_var indep_var1 indep_var2 if Observation_Year <= 1977,
robust cluster (firms)

If your first observation in the database is 1977, you are trying to
run an ols with only one observation, with degree of freedom.

I think you need to provide us more information.

Hope this helps,

Joao Lima

2008/10/5 <[email protected]>:
> Dear Stata users ,
>
> I am using this command to run a OLS regression:
>
> forvalues i=1977/2007 {
> reg dependent_var indep_var1 indep_var2 if Observation_Year <= `i',
robust cluster (firms)
> }
>
> However, STATA displays in this case "no observations" and it is not
possible to run the regression.
>
> For instance, in 1980, I have observations of the second independent
variable and the dependent variable only, but I thought that STATA would
ignore this year and continue the regression in 1981 instead. Obviously, it is
not the case!
>
> So what should I do about this problem ? Any ideas???
>
> Thank you very much !
>
> Bastian S
> --
> Psssst! Schon vom neuen GMX MultiMessenger geh�rt? Der kann`s mit
allen: http://www.gmx.net/de/go/multimessenger
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>



--
-------------------------------
Joao Ricardo Lima
Professor
UFPB-CCA-DCFS
+553138923914
-------------------------------

*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
--
GMX Kostenlose Spiele: Einfach online spielen und Spa� haben mit Pastry Passion!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/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/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