Apunts Stata amb comandos basics PDF

Title Apunts Stata amb comandos basics
Course Econometria
Institution Universitat Pompeu Fabra
Pages 6
File Size 558.2 KB
File Type PDF
Total Downloads 2
Total Views 150

Summary

llistat de diferents comandos d'STATA útil per clarificar idees...


Description

STATA It is an econometric software that allows to implement theoretical applications, to real or simulated data, with the use of prefedined commands or taylored code. Why do we us STATA? -

Cross sectional Data, Panel Data and Time Series Fast and powerful when manipulating and analyzing data Specially designed for the needs and wants of economists The documentation (Help) is very thorough We have 4 file types: -

-

*.dta to save STATA data (archivos de almacenamiento de datos ordenados por variables específicos del STATA) *do to save a list of commands *.log text file to save outputs & commands *.gph to save graphs generated by commands

STATA’s main screen: Stata includes a ‘menu bar’, a ‘gadget bar’ ( barra de herramientas) and four windows:

Variable window  it presents the variables’ name in our data Command window  where we introduce the commands and execute the by pressing the ENTER; once they are executed the command disappears from this window. Result window  where we can see the result of the execution of the commands; at these results we will be calling them “outputs”. Review window  it presents the commands that have been executed.

How do we interact with STATA? -

Graphical Interface based

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. -

To open a *.dta file Save the changes done to the file Print graphs or information of the viewer To start a *.log file to save the output and to pause and close it Viewer: to open a window with Help To see the graphs which have been done during the session To open a new editor of ‘do file’ It opens an excel shit to modify the data of the active variables Data Browser: it opens an excel sheet where you can see the variables Go: it continues the execution of a command once it has been paused Break: it stops any command that is being executed in second place

Coding based approach  Command Window approach



By entering the commands one by one in the command window and by executing them. *.do file approach

It allows you to input all the list of commands, by highlighting the commands you want to execute and by clicking the ‘do’ button, you will be executing all the highlighted ones.

1.

Run: It will execute either all the highlighted commands or all the *.do file by defect, without showing the outputs in the Result Window. 2. Do: It will execute either all the highlighted commands or all the *.do file by defect, showing the outputs in the Result Window. How and why do we comment code? An advantage to use *.do files is that we can add comments, explain, titles… which do not have to be executed. For the lines which correspond to comments, that are not commands, we have to initiate de sentence with /* and end it with */. Ex. To identify different parts of the work:

General STATA syntax STATA in order to process your commands needs you to follow and index, more precisely, you need to follow a syntax that looks like this in general:

Ex.

You don’t have to know all the conditions, restrictions, options… that you can add; by using the ‘Help’ service you can know them. A window will appear where you can search the command and a manual will be opened (useful: quick start).

Data commands:

(sólo de variables numéricas)

tabulate v1 v2  genera una tabla de frecuencias

corr x1 x2  correlación entre distintas variables

describe  me describe el tipo de variable que es str (string)  caracteres/letras; importante: comillas double/float/int/byte  número

Graph commands:

Variable commands: keep variables  quedate con las siguients variales que estan abiertas en el fichero drop variables  elimina las variables que te voy a nombrar

P-VALUE display normal (x) display invnormal ((p) p) CH SIMPLE para un CH con H0: mu = mu* H1: 2 colas, cola izquierda, cola derecha ttest variable = mu*

CH PARA LA DIFERENCIA DE MEDIAS: Para un CH con H0: muY – muX = 0 H1: 2 colas, cola izquierda, cola derecha

Con STATA tenemos 2 opciones: ttest Y = X , unpaired

ttest Y, by (grupo)

MODELOS PARA Y:...


Similar Free PDFs