CAMERON, C. e TRIVEDI, P.K. Microeconometrics Using Stata. Cambridge: CUP, 2010
CAMERON, C. e TRIVEDI, P.K. Microeconometrics Using Stata. Cambridge: CUP, 2010
CAMERON, C. e TRIVEDI, P.K. Microeconometrics Using Stata. Cambridge: CUP, 2010
Capítulo 1. StataBasics
operações: barra de comandos (+ rápido) ou menu interativo.
update query
help (help regress); sempre voltar ao help
search(search regress, nocons)
summarize (t*)
regress
by variable: command(sort, sum, reg)
quietly command (exemplo sum)
operator: aritméticos/relacionais/lógicos
o + (addition)
o – (subtraction)
o * (multiplication)
o / (division)
o ^ (raisedto a Power)
o > (greaterthan)
o < (lessthan)
o >= (greaterthan or equal)
o <= (lessthan or equal)
o == (equal)
o != (note qual)
o Logical operators: & (and), | (or), ! (not), ~(not)
Do-files and log files: .do (program), .dta (database), .log (output), .txt (output)
o To create a log file in text form named example.txt, the usual command
is: log using example.txt, text replace
o In do-files:
For single-line comments, begin the line with an asterisk (*)
For a comment on the same line as a Stata command, use two
slashes (//) after the Stata command.
For multiple-line comments, place the commented text between
slash-star (/*) and star-slash (*/).
query/set
scalar a=2
display (2*2, 2/0)
matrix (matrix define D = (1, 5 \ 6, 8); matrix list D; matrix invD = inv(D); matrix
list invD)
r-class commands (analyze data but nor estimate parameters)
o return list (eg. sum before)
e-class commands (estimation commands after a regression command)
o ereturn list (eg. reg before)
Capítulo 2. Data management and graphics
clear
use (read a stata dataset .dta)
edit (enter data from the keyboard or the data editor
insheet (read comma-separated or tab-separated text data created by a
spreadsheet)
infile (read unformatted or fixed-format text data)
infix (read formatted data)
tabulate / table
if
replace
generate(eg. gen attendancehigh=0, replace attendancehigh=1 if
attendance>=50000; tabulate rodada, generate(rodada); gen goals2=goals^2,
lgoals=log(goals)
egen (combined with by)
recode
bysortvariable: command ….
Indicator variables:
o quietly tabulate variable, generate(name_dummy)
save (save only a stata data file)
outsheet (save the dataset as comma-separated values spreadsheet):
o outsheetvariables using filename.csv, comma replace
outfile (save a space-delimited formatted text file):
o outfilevariables using filename.asc, replace
keep
drop
twoway scatter
graph combine (scatter y attendance, salvar, scatter y rodada, salvar, gr
combine)
histogram
kdensity
graph matrix (graph matrix y rodada goals)
- swilk r
- sfrancia r
- sktest r
kdensity (Kernel)
qreg (quantile)