Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf ·...
Transcript of Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf ·...
![Page 1: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/1.jpg)
Joaquim J.S. Ramalho
ECONOMETRIA I
Resoluções dos Exercícios Práticos - Stata
![Page 2: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/2.jpg)
Joaquim J.S. Ramalho
Inserção de comandos
Selecção de comandos no menu▪ Útil quando não se conhece o nome do comando
Introdução manual de comandos▪ Mais rápida
Execução de comandos gravados num ficheiro do▪ Ideal para processos repetitivos
▪ Implementação de métodos não disponíveis no Stata
Stata
2017/2018 Econometria I 2
![Page 3: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/3.jpg)
Joaquim J.S. Ramalho
Stata – Janelas Principais
2017/2018 Econometria I 3
Inserção manual de comandos
Histórico de comandos
Resultados
Lista de variáveis
![Page 4: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/4.jpg)
Joaquim J.S. Ramalho
File
Open – abre ficheiro de dados em formato dta
Save – grava ficheiro de dados em formato dta
Log – os resultados que aparecem na janela de resultados são simultaneamente gravados num ficheiro smcl (apenas pode ser aberto no Stata) ou log (ficheiro de texto que pode ser lido por qualquer software)▪ Begin – inícia a gravação
▪ Close – termina a gravação
▪ Suspend – suspende temporariamente a gravação
▪ Resume – retoma a gravação
Stata – Menus Principais
2017/2018 Econometria I 4
![Page 5: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/5.jpg)
Joaquim J.S. Ramalho
Window
Data Editor – abre folha tipo excel para introdução, alteração ou visualização de dados
Help
Search – se não se souber o nome do comando
Stata command – se se souber o nome do comando
Stata – Menus Principais (cont.)
2017/2018 Econometria I 5
![Page 6: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/6.jpg)
Joaquim J.S. Ramalho
Stata – Principais Botões
2017/2018 Econometria I 6
Open
Save
Log
Data Editor
Interrompe a execução de um comando
![Page 7: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/7.jpg)
Joaquim J.S. Ramalho
. summarize X
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
X | 10 566 229.6955 300 1100
Exercício 1.1 – a
2017/2018 Econometria I 7
![Page 8: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/8.jpg)
Joaquim J.S. Ramalho
. summarize X, d
X
-------------------------------------------------------------
Percentiles Smallest
1% 300 300
5% 300 350
10% 325 440 Obs 10
25% 440 450 Sum of Wgt. 10
50% 505 Mean 566
Largest Std. Dev. 229.6955
75% 670 640
90% 900 670 Variance 52760
95% 1100 700 Skewness 1.189377
99% 1100 1100 Kurtosis 3.967482
Exercício 1.1 – b
2017/2018 Econometria I 8
![Page 9: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/9.jpg)
Joaquim J.S. Ramalho
. clear
. summarize X Y, d
X
-------------------------------------------------------------
Percentiles Smallest
1% 4.7 4.7
5% 4.7 5.2
10% 4.7 8.4 Obs 8
25% 6.8 9.3 Sum of Wgt. 8
50% 9.8 Mean 9.8375
Largest Std. Dev. 3.811988
75% 12.7 10.3
90% 15.4 11.3 Variance 14.53125
95% 15.4 14.1 Skewness .0394896
99% 15.4 15.4 Kurtosis 1.898667
Exercício 1.2 – a
2017/2018 Econometria I 9
![Page 10: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/10.jpg)
Joaquim J.S. Ramalho
Y
-------------------------------------------------------------
Percentiles Smallest
1% 2.1 2.1
5% 2.1 3.5
10% 2.1 4.5 Obs 8
25% 4 5.1 Sum of Wgt. 8
50% 6.35 Mean 7.1875
Largest Std. Dev. 4.068849
75% 10.75 7.6
90% 13.2 9.5 Variance 16.55554
95% 13.2 12 Skewness .2968191
99% 13.2 13.2 Kurtosis 1.666582
Exercício 1.2 – a (cont.)
2017/2018 Econometria I 10
![Page 11: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/11.jpg)
Joaquim J.S. Ramalho
. cor X Y, c
(obs=8)
| X Y
-------------+------------------
X | 14.5313
Y | 12.9634 16.5555
. cor X Y
(obs=8)
| X Y
-------------+------------------
X | 1.0000
Y | 0.8358 1.0000
Exercício 1.2 – b
2017/2018 Econometria I 11
![Page 12: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/12.jpg)
Joaquim J.S. Ramalho
. gen Xnew=10*X
. summarize Xnew, d
Xnew
-------------------------------------------------------------
Percentiles Smallest
1% 47 47
5% 47 52
10% 47 84 Obs 8
25% 68 93 Sum of Wgt. 8
50% 98 Mean 98.375
Largest Std. Dev. 38.11988
75% 127 103
90% 154 113 Variance 1453.125
95% 154 141 Skewness .0394897
99% 154 154 Kurtosis 1.898667
Exercício 1.2 – c
2017/2018 Econometria I 12
![Page 13: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/13.jpg)
Joaquim J.S. Ramalho
. cor Xnew Y, c
(obs=8)
| Xnew Y
-------------+------------------
Xnew | 1453.13
Y | 129.634 16.5555
. cor Xne Y
(obs=8)
| Xnew Y
-------------+------------------
Xnew | 1.0000
Y | 0.8358 1.0000
Exercício 1.2 – c (cont.)
2017/2018 Econometria I 13
![Page 14: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/14.jpg)
Joaquim J.S. Ramalho
. regress Y X
Source | SS df MS Number of obs = 10
---------+------------------------------ F( 1, 8) = 374.92
Model | 26.0100006 1 26.0100006 Prob > F = 0.0000
Residual | .555000229 8 .069375029 R-squared = 0.9791
---------+------------------------------ Adj R-squared = 0.9765
Total | 26.5650009 9 2.95166676 Root MSE = .26339
------------------------------------------------------------------------------
Y | Coef. Std. Err. t P>|t| [95% Conf. Interval]
---------+--------------------------------------------------------------------
X | 1.7 .0877971 19.363 0.000 1.497539 1.902461
_cons | 1.26 .3353575 3.757 0.006 .4866642 2.033336
------------------------------------------------------------------------------
. display 1.7*3
5.1
Exercício 2.4 – a
2017/2018 Econometria I 14
![Page 15: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/15.jpg)
Joaquim J.S. Ramalho
. gen yhat=1.26+1.7*X
ou
. predict yhat2
(option xb assumed; fitted values)
. scatter yhat Y X, connect(l i)
Exercício 2.4 – b
2017/2018 Econometria I 15
46
81
0
2 3 4 5X
yhat Y
![Page 16: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/16.jpg)
Joaquim J.S. Ramalho
c)
. gen uhat= Y-yhat
ou
. predict uhat2, resid
. summarize uhat
Variable | Obs Mean Std. Dev. Min Max
---------+-----------------------------------------------------
uhat | 10 -4.77e-08 .2483279 -.3600006 .3400002
e)
. display 1.26+1.7*5.2
10.1
Exercício 2.4 – c, e
2017/2018 Econometria I 16
![Page 17: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/17.jpg)
Joaquim J.S. Ramalho
. regress sono trab
Source | SS df MS Number of obs = 706
-------------+------------------------------ F( 1, 704) = 81.09
Model | 14381717.2 1 14381717.2 Prob > F = 0.0000
Residual | 124858119 704 177355.282 R-squared = 0.1033
-------------+------------------------------ Adj R-squared = 0.1020
Total | 139239836 705 197503.313 Root MSE = 421.14
------------------------------------------------------------------------------
sono | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
trab | -.1507458 .0167403 -9.00 0.000 -.1836126 -.117879
_cons | 3586.377 38.91243 92.17 0.000 3509.979 3662.775
------------------------------------------------------------------------------
Exercício 2.5 – a
2017/2018 Econometria I 17
![Page 18: Apresentação do PowerPointhome.iscte-iul.pt/~jjsro/ecoi/Praticas-Resolucoes-temp.pdf · 2020-03-03 · . scatter yhat sono trab, connect(l i) c). display -0.1507458*120-18.089496](https://reader033.fdocumentos.tips/reader033/viewer/2022060421/5f17c7533b83a51a0f30b6cb/html5/thumbnails/18.jpg)
Joaquim J.S. Ramalho
b)
. predict yhat
(option xb assumed; fitted values)
. scatter yhat sono trab, connect(l i)
c)
. display -0.1507458*120
-18.089496
Exercício 2.5 – b, c
2017/2018 Econometria I 18
100
02
00
03
00
04
00
05
00
0
0 2000 4000 6000min/sem
Fitted values min/sem