Escolar Documentos
Profissional Documentos
Cultura Documentos
AULA PRÁTICA 1:
No STATA, comecei reconhecendo que se tratava de uma série temporal com variação mensal
com início em janeiro de 1999 e término em fevereiro de 2012:
Logo após, foi feito o gráfico de linha, de autocorrelação e autocorrelação parcial, correlação e
correlação parcial respectivamente:
3.5
2.5
1.5
4
2
txc
.
Posteriormente foi feito o Modelo ARIMA:
OPG
txc Coef. Std. Err. z P>|z| [95% Conf. Interval]
txc
_cons 2.116314 .4396405 4.81 0.000 1.254634 2.977993
ARMA
ar
L1. .9637404 .0204027 47.24 0.000 .9237518 1.003729
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
. estat ic
OPG
txc Coef. Std. Err. z P>|z| [95% Conf. Interval]
txc
_cons 2.138261 .3740157 5.72 0.000 1.405204 2.871319
ARMA
ar
L1. .8685926 .0435986 19.92 0.000 .7831408 .9540443
L2. .3580502 .0633495 5.65 0.000 .2338875 .482213
L3. -.2657033 .0650416 -4.09 0.000 -.3931825 -.1382241
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
. estat ic
OPG
txc Coef. Std. Err. z P>|z| [95% Conf. Interval]
txc
_cons 2.082253 .480886 4.33 0.000 1.139734 3.024772
ARMA
ar
L1. .8281826 .0445721 18.58 0.000 .7408228 .9155424
L2. .4178133 .0758289 5.51 0.000 .2691913 .5664352
L3. -.1881531 .1264417 -1.49 0.137 -.4359743 .059668
L4. -.0658163 .0967594 -0.68 0.496 -.2554613 .1238287
L5. .0609689 .1024064 0.60 0.552 -.1397439 .2616817
L6. -.1838271 .0898908 -2.05 0.041 -.3600099 -.0076442
L7. -.2197087 .0868166 -2.53 0.011 -.3898661 -.0495514
L8. .3230196 .0697797 4.63 0.000 .1862538 .4597854
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
. estat ic
Comparando os resultados, para AIC o modelo mais rigoroso é o ARIMA (8,0,0) e para o BIC o
modelo mais rigoroso é o ARIMA (3,0,0). O modelo ARIMA (1,0,0) não se destacou.
AULA PRÁTICA 2:
DF drift:
. dfuller txc, drift regress lags(0)
txc
L1. -.0315414 .0207326 -1.52 0.130 -.0724963 .0094136
DF trend:
. dfuller txc, trend regress lags(0)
Interpolated Dickey-Fuller
Test 1% Critical 5% Critical 10% Critical
Statistic Value Value Value
txc
L1. -.0430963 .0222448 -1.94 0.055 -.0870406 .000848
_trend -.0003626 .0002581 -1.40 0.162 -.0008725 .0001474
_cons .122201 .06078 2.01 0.046 .0021308 .2422712
Excluindo a tendência:
. dfuller txc, regress lags(0)
Interpolated Dickey-Fuller
Test 1% Critical 5% Critical 10% Critical
Statistic Value Value Value
txc
L1. -.0315414 .0207326 -1.52 0.130 -.0724963 .0094136
PP trend:
. pperron txc, trend regress
Interpolated Dickey-Fuller
Test 1% Critical 5% Critical 10% Critical
Statistic Value Value Value
txc
L1. .9569037 .0222448 43.02 0.000 .9129594 1.000848
_trend -.0003626 .0002581 -1.40 0.162 -.0008725 .0001474
_cons .122201 .06078 2.01 0.046 .0021308 .2422712
PP noconstant:
. . pperron txc, noconstant regress
Interpolated Dickey-Fuller
Test 1% Critical 5% Critical 10% Critical
Statistic Value Value Value
txc
L1. .9975744 .0048149 207.19 0.000 .9880636 1.007085
PP excluindo a tendência:
. pperron txc, regress
Interpolated Dickey-Fuller
Test 1% Critical 5% Critical 10% Critical
Statistic Value Value Value
txc
L1. .9684586 .0207326 46.71 0.000 .9275037 1.009414
Interpolated Dickey-Fuller
Test 1% Critical 5% Critical 10% Critical
Statistic Value Value Value
dtxc
L1. -1.147616 .0793659 -14.46 0.000 -1.304394 -.9908375
dtxc
L1. -1.147818 .0796149 -14.42 0.000 -1.305096 -.9905395
dtxc
L1. -.8579961 .1170779 -7.33 0.000 -1.089306 -.626686
LD. -.2441947 .0772888 -3.16 0.002 -.3968938 -.0914957
.
PP:
Interpolated Dickey-Fuller
Test 1% Critical 5% Critical 10% Critical
Statistic Value Value Value
dtxc
L1. -.1476158 .0793659 -1.86 0.065 -.3043942 .0091625
Interpolated Dickey-Fuller
Test 1% Critical 5% Critical 10% Critical
Statistic Value Value Value
dtxc
L1. -.1478178 .0796149 -1.86 0.065 -.3050961 .0094605
Interpolated Dickey-Fuller
Test 1% Critical 5% Critical 10% Critical
Statistic Value Value Value
dtxc
L1. -.1513287 .0798511 -1.90 0.060 -.3090818 .0064243
_trend -.0001872 .0002432 -0.77 0.443 -.0006677 .0002934
_cons .0122156 .0219989 0.56 0.580 -.0312453 .0556764
-.5
.5
dtxc
1
0
Além disso, para a nova variável foram feitos os mesmos gráficos:
-1 0 1 -1 0 1
LAG AC PAC Q Prob>Q [Autocorrelation] [Partial Autocor]
.
ARIMA (1,1,1):
ARIMA regression
OPG
D.txc Coef. Std. Err. z P>|z| [95% Conf. Interval]
txc
_cons -.0018679 .0109663 -0.17 0.865 -.0233615 .0196256
ARMA
ar
L1. -.7451211 .1961867 -3.80 0.000 -1.12964 -.3606023
ma
L1. .5945923 .2005321 2.97 0.003 .2015566 .9876279
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
. estat ic
ARIMA (1,1,0):
ARIMA regression
OPG
D.txc Coef. Std. Err. z P>|z| [95% Conf. Interval]
txc
_cons -.0017609 .0108849 -0.16 0.871 -.0230949 .0195732
ARMA
ar
L1. -.1471757 .0399191 -3.69 0.000 -.2254157 -.0689357
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
. estat ic
ARIMA (2,1,1):
ARIMA regression
OPG
D.txc Coef. Std. Err. z P>|z| [95% Conf. Interval]
txc
_cons -.0027948 .0155862 -0.18 0.858 -.0333432 .0277535
ARMA
ar
L1. .0642285 .3359015 0.19 0.848 -.5941264 .7225834
L2. .2795248 .0456697 6.12 0.000 .1900138 .3690358
ma
L1. -.1880438 .3285774 -0.57 0.567 -.8320437 .4559562
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
. estat ic
ARIMA (3,1,3):
ARIMA regression
OPG
D.txc Coef. Std. Err. z P>|z| [95% Conf. Interval]
txc
_cons -.0027751 .015726 -0.18 0.860 -.0335974 .0280473
ARMA
ar
L1. -.4873317 .5773176 -0.84 0.399 -1.618854 .6441901
L2. -.1529735 .5281201 -0.29 0.772 -1.18807 .8821228
L3. .4655568 .4405551 1.06 0.291 -.3979154 1.329029
ma
L1. .4198356 .5736354 0.73 0.464 -.7044691 1.54414
L2. .3902986 .4930995 0.79 0.429 -.5761587 1.356756
L3. -.4302484 .5265828 -0.82 0.414 -1.462332 .6018349
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
. estat ic
Dentre os modelos gerados, o Modelo ARIMA (2,1,1) apresentou menor AIC e menor BIC, por
isso é o modelo mais rigoroso.
AULA PRÁTICA 3:
Na série temporal analisada, observando os gráficos não é possível ver claramente a presença
de sazonalidade. Ainda, foi feito o modelo SARIMA para observação:
OPG
S12.dtxc Coef. Std. Err. z P>|z| [95% Conf. Interval]
dtxc
_cons -.0022419 .0031466 -0.71 0.476 -.0084091 .0039252
ARMA
ar
L1. -.1473183 .047902 -3.08 0.002 -.2412045 -.0534321
ARMA12
ar
L1. -.0066216 .078249 -0.08 0.933 -.1599868 .1467437
ma
L1. -1 . . . . .
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
. estat ic
OPG
dtxc Coef. Std. Err. z P>|z| [95% Conf. Interval]
dtxc
_cons -.0017693 .0112294 -0.16 0.875 -.0237785 .0202398
ARMA
ar
L1. -.1472017 .0399732 -3.68 0.000 -.2255478 -.0688556
ARMA12
ar
L1. .0009425 .1211712 0.01 0.994 -.2365487 .2384337
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
. estat ic
Comparando os testes, pode-se concluir que o modelo SARIMA (1,0,0,12) possui menor AIC e
menor BIC sendo então o modelo mais rigoroso.
AULA PRÁTICA 4:
OPG
txc Coef. Std. Err. z P>|z| [95% Conf. Interval]
txc
_cons 2.144441 .4779337 4.49 0.000 1.207708 3.081174
ARMA
ar
L1. .9627033 .0231887 41.52 0.000 .9172543 1.008152
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
-arima txc in 1/144, arima(3,0,0)
ARIMA regression
OPG
txc Coef. Std. Err. z P>|z| [95% Conf. Interval]
txc
_cons 2.181942 .3812766 5.72 0.000 1.434654 2.929231
ARMA
ar
L1. .8765272 .0457577 19.16 0.000 .7868437 .9662107
L2. .3644282 .0660851 5.51 0.000 .2349037 .4939526
L3. -.282927 .0674472 -4.19 0.000 -.4151211 -.150733
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
OPG
txc Coef. Std. Err. z P>|z| [95% Conf. Interval]
txc
_cons 2.140746 .4651343 4.60 0.000 1.2291 3.052393
ARMA
ar
L1. .8369126 .046193 18.12 0.000 .7463761 .9274492
L2. .4230288 .0780712 5.42 0.000 .270012 .5760456
L3. -.2253225 .1302933 -1.73 0.084 -.4806927 .0300476
L4. -.0423858 .0998222 -0.42 0.671 -.2380337 .1532621
L5. .088244 .1080331 0.82 0.414 -.1234969 .2999849
L6. -.2112486 .094412 -2.24 0.025 -.3962927 -.0262045
L7. -.2327064 .0919422 -2.53 0.011 -.4129098 -.0525031
L8. .3330829 .0735333 4.53 0.000 .1889604 .4772055
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
E foi feito a previsão “one-step prediction” para os três modelos estimados respectivamente:
Logo após foi feito o erro absoluto percentual de cada modelo estimado e sua média:
Obs: os valores encontrados são diferentes dos da aula prática 4 porque foram usados valores
arredondados da taxa de câmbio.
mês txc dtxc ftxc AR(1) ftxc AR (3) ftxc AR(8) EAP AR1 EAP AR3 EAP AR8
2010m10 1,7 .01 1,706949 1,716353 1,734926 0,408765 0,961941 2,054471
2010m11 1,72 .02 1,716576 1,699608 1,696244 0,19907 1,185581 1,381163
2010m12 1,67 -.05 1,735830 1,740588 1,696082 3,941916 4,226826 1,561796
2011m1 1,67 0 1,687695 1,701221 1,706493 1,059581 1,869521 2,18521
2011m2 1,66 -.01 1,6876950 1,677341 1,676880 1,668373 1,044639 1,016867
2011m3 1,63 -.03 1,6780680 1,682722 1,681276 2,948957 3,234479 3,145767
2011m4 1,57 -.06 1,6491870 1,652782 1,670000 5,043758 5,272739 6,369427
2011m5 1,58 .01 1,5914250 1,592086 1,575067 0,723101 0,764937 0,312215
2011m6 1,56 -.02 1,6010520 1,587474 1,574477 2,631538 1,761154 0,928013
2011m7 1,56 0 1,5817980 1,590563 1,594175 1,397308 1,959167 2,190705
2011m8 1,59 .03 1,5817980 1,580445 1,568815 0,515849 0,600943 1,33239
2011m9 1,85 .26 1,6106790 1,612400 1,601375 12,93627 12,84324 13,43919
2011m10 1,69 -.16 1,8609820 1,851230 1,849719 10,11728 9,540237 9,450828
2011m11 1,82 .13 1,7069490 1,797249 1,819133 6,211593 1,250055 0,047637
2011m12 1,88 .06 1,8321010 1,779328 1,782304 2,547819 5,354894 5,196596
2012m1 1,74 -.14 1,8898630 1,924563 1,923177 8,612816 10,60707 10,52741
2012m2 1,71 -.03 1,7550840 1,786935 1,818825 2,636491 4,499123 6,364035
SOMA 63,60048 66,97655 67,50372
MAPE 3,741205 3,939797 3,970807
Logo, o melhor modelo a ser utilizado é aquele que tem menor MAPE, modelo ARIMA (1,0,0).
A partir de então usaremos o modelo ARIMA (1,0,0):
ARIMA regression
OPG
txc Coef. Std. Err. z P>|z| [95% Conf. Interval]
txc
_cons 2.116314 .4396405 4.81 0.000 1.254634 2.977993
ARMA
ar
L1. .9637404 .0204027 47.24 0.000 .9237518 1.003729
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
Adicionei mais 10 meses na série (até o final de 2012) e pedi para o software fazer a previsão:
. predict ftxc12, y
ARIMA (2,1,1)
ARIMA regression
OPG
D.txc Coef. Std. Err. z P>|z| [95% Conf. Interval]
txc
_cons -.0027948 .0155862 -0.18 0.858 -.0333432 .0277535
ARMA
ar
L1. .0642285 .3359015 0.19 0.848 -.5941264 .7225834
L2. .2795248 .0456697 6.12 0.000 .1900138 .3690358
ma
L1. -.1880438 .3285774 -0.57 0.567 -.8320437 .4559562
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
Gerando a previsão:
A PARTIR DA AULA PRÁTICA 5 NÃO É POSSÍVEL FAZER OS EXEMPLOS APENAS COM UMA
VARIÁVEL.