Old syntax working with stata10 but not 11

Fragen zu Stata Syntax und Do-Files.

Old syntax working with stata10 but not 11

Beitragvon dan12 » Do 7. Feb 2013, 18:16

Hey,
I am trying to replicate a paper by Sachs and Warner '97.
But the code they use to check for outliers doesn't work with stata 11.2
An outlier should be excluded if "|dfits| > 2(k/n)^(1/2)" while k is the number of regressors and n is the sample size

Their code:

fit gea7090 lgdpea70 sxp sopen
drop dfits
fpredict dfits, dfits
gsort -dfits

* list country dfits shcode6 if dfits~=.
drop excl1
generate excl1=0
replace excl1=1 if abs(dfits)> 2*((_result(3)+1)/(_result(1)))^(1/2)
list country dfits if dfits~=. & excl1==1,

Now my question is, how can I change this code to work with Stata11.2

Thanks in advance

Daniel
dan12
 
Beiträge: 5
Registriert: Di 15. Jan 2013, 13:09
Danke gegeben: 0
Danke bekommen: 0 mal in 0 Post

Re: Old syntax working with stata10 but not 11

Beitragvon daniel » Do 7. Feb 2013, 18:26

Unfortunatly, you do not give precise references (there might not be many people out there, how know what "Sachs and Warner '97." is, nor where to find it). This is not essetial to your question, but it sure would not hurt to give title and journal (or book).

More important, you do not say what exactly "does not work" mean. Chances for good advice (or any answer at all) decrease whenever you do not tell us exactly what you have typed (which you did) and what exactly Stata did.

How do you know the code works with Stata 10? Did you try it? If so, why do you not use Stata 10 to replicate the resulst? If not, the initial question applies.

If the code did work with Stata 10, just include a -version 10- statment in your syntax.
Stata is an invented word, not an acronym, and should not appear with all letters capitalized: please write “Stata”, not “STATA”.
daniel
 
Beiträge: 1060
Registriert: Sa 1. Okt 2011, 17:20
Danke gegeben: 0
Danke bekommen: 0 mal in 0 Post

Re: Old syntax working with stata10 but not 11

Beitragvon dan12 » Fr 8. Feb 2013, 14:18

Das stimmt natürlich. Danke für die schnelle Antwort.
Ich war scheinbar etwas durch, sodass ich nicht einmal gemerkt habe, dass ich hier auf deutsch schreiben kann ;)

Das Problem konnte ich nun lösen:

Hier trotzdem noch genauere Informationen zum Paper:
Sachs, Jeffrey D. and Andrew M. Warner, "Natural Resource Abundance and Economic Growth" (PDF, revised November 1997)
Do-file und Datensatz habe ich von :
http://www.cid.harvard.edu/ciddata/ciddata.html

Der Gedanke ist vielleicht Luxus aber ich tendiere zu Stata11.2 aufgrund des übersichtlicheren Editors :roll:

Nachdem ich versucht habe das paper mit Stata 11.2 zu replizieren, aber auf unterschiedliche Ergebnisse kam, habe ich verzweifelter Weise Stata 10.1 benutzt, wo es funktioniert.
Der Unterschied liegt darin, dass bei der Identifizierung der outlier bei Stata10.1 "124 real changes" durchgeführt werden und bei Stata11.2 nur 120 changes, wobei er keine outlier identifiziert und somit auch nicht auflistet:

In Stata 10:
. replace excl1=1 if abs(dfits)> 2*((_result(3)+1)/(_result(1)))^(1/2)
(124 real changes made)
.
. list country dfits if dfits~=. & excl1==1

+----------------------+
| country dfits |
|----------------------|
1. | MALAYSIA .6339695 |
2. | GABON .43859 |
90. | CHAD -.6186714 |
91. | GUYANA -.6214592 |
+----------------------+



In Stata11.2

replace excl1=1 if abs(dfits)> 2*((_result(3)+1)/(_result(1)))^(1/2)
(120 real changes made)

.
. list country dfits if dfits~=. & excl1==1


Der Rat mit dem Statement (also "version 10.1" am Anfang der do-file) hat leider nicht funktioniert.
Daher habe ich nun nach eingiem herumprobieren das "_result" in der replace-Zeile herausgenommen und selber für k und n eingesetzt.
Nun klappt es für k=4 und n=91 >>> replace excl1=1 if abs(dfits)> 2*(4/91)^(1/2)
Scheinbar ist der Zusatz _result veraltet...

Danke
dan12
 
Beiträge: 5
Registriert: Di 15. Jan 2013, 13:09
Danke gegeben: 0
Danke bekommen: 0 mal in 0 Post

Re: Old syntax working with stata10 but not 11

Beitragvon daniel » Fr 8. Feb 2013, 19:56

Unter -help whatsnew10to11- sind alle Änderungen zwischen den Versionen dokumentiert. Dort kannst Du mal reinschauen, ob und welche Befehle sich wie geändert haben. Dass Du allerdings mit -version- statement nicht die Ergebnisse replizieren kannst deutet auf eine Anwednungsfehler hin. Wenn Stata in einer Sache gut ist, dann in Rückwärtskompatibilität.
Stata is an invented word, not an acronym, and should not appear with all letters capitalized: please write “Stata”, not “STATA”.
daniel
 
Beiträge: 1060
Registriert: Sa 1. Okt 2011, 17:20
Danke gegeben: 0
Danke bekommen: 0 mal in 0 Post


Zurück zu Stata Syntax

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 2 Gäste

cron