You are on page 1of 36

> dados0=read.table("max_seco_cam.

txt",dec=",",h=T)

> attach(dados0)

The following objects are masked from dados (pos = 3):

Ago., ano, Jul., Jun., Mai., Max, Out., Set.

The following objects are masked from dados0 (pos = 4):

Ago., ano, Jul., Jun., Mai., Max, Out., Set.

The following objects are masked from dados0 (pos = 5):

ano, Max

The following objects are masked from dados (pos = 15):

ano, Max

>

> dados0

ano Mai. Jun. Jul. Ago. Set. Out. Max

1 1965 231 108 107 102 89 121 231

2 1966 135 106 85 75 62 159 159

3 1967 128 134 106 75 78 137 137

4 1968 69 58 52 57 89 98 98

5 1969 124 100 69 81 51 110 124

6 1970 77 66 62 100 105 88 105

7 1971 49 116 46 38 60 112 116

8 1972 91 78 136 89 63 221 221

9 1973 136 78 83 57 59 198 198

10 1974 110 122 89 66 50 120 122

11 1975 83 57 70 46 60 82 83

12 1976 107 113 129 146 258 156 258

13 1977 138 88 74 60 108 75 138

14 1978 92 96 78 55 58 255 255

15 1979 123 110 105 93 168 101 168

16 1980 121 143 101 78 77 93 143

17 1981 123 106 77 85 63 173 173

18 1982 158 132 105 90 71 272 272

19 1983 368 635 266 151 473 314 635

20 1984 176 92 77 80 99 84 176

21 1985 131 112 86 75 91 101 131

22 1986 136 104 105 118 67 61 136

23 1987 130 105 85 74 120 114 130

24 1988 140 116 83 68 62 129 140

25 1989 119 116 94 100 93 99 119

26 1990 109 71 73 59 96 68 109

27 1991 169 94 87 74 91 128 169

28 1992 158 92 92 68 189 159 189

29 1993 109 143 78 66 84 129 143

30 1994 386 104 79 63 49 92 386

31 1995 92 67 62 46 86 126 126

32 1996 99 72 73 84 200 104 200

33 1997 132 152 84 70 92 87 152

34 1998 132 131 59 75 49 101 132

35 1999 88 77 67 51 51 58 88

36 2000 94 75 70 62 141 76 141

37 2001 70 50 40 43 54 102 102

38 2002 89 63 59 60 65 85 89

39 2003 107 87 80 51 55 79 107

40 2004 135 114 91 80 77 92 135

41 2005 199 122 117 85 93 97 199

42 2006 99 69 68 53 86 102 102

43 2007 96 81 69 59 49 81 96

44 2008 108 86 75 56 73 112 112

45 2009 128 106 104 86 129 175 175

46 2010 121 100 102 71 72 122 122

47 2011 139 129 91 76 63 149 149

48 2012 140 148 88 67 58 72 148

49 2013 113 111 88 76 73 104 113

50 2014 45 41 39 38 31 30 45

51 2015 67 44 35 32 77 52 77

52 2016 65 94 50 46 50 67 94

53 2017 91 71 45 39 32 72 91

> max0<-(dados0$Max[1:29])

> dados=read.table("max_seco.txt",dec=",",h=T)

> attach(dados)

The following objects are masked from dados0 (pos = 3):

Ago., ano, Jul., Jun., Mai., Max, Out., Set.

The following objects are masked from dados (pos = 4):

Ago., ano, Jul., Jun., Mai., Max, Out., Set.

The following objects are masked from dados0 (pos = 5):

Ago., ano, Jul., Jun., Mai., Max, Out., Set.

The following objects are masked from dados0 (pos = 6):

ano, Max

Jun.The following objects are masked from dados (pos = 16): ano. Out. Max > getwd() [1] "C:/Users/Usuario/Dropbox/rotinas_tabelas/dados reservatórios/Camargos/GVE" > dados ano Mai. Jul. Ago. Max 1 1965 1946 1180 1140 878 958 1505 1946 2 1966 1254 809 628 581 557 1372 1372 3 1967 1037 936 672 604 526 1049 1049 4 1968 503 431 399 445 567 731 731 5 1969 513 603 395 385 230 807 807 6 1970 617 471 477 706 945 635 945 7 1971 379 708 368 240 309 899 899 8 1972 726 648 1205 690 471 1222 1222 9 1973 807 563 530 435 407 738 807 10 1974 775 937 729 435 346 747 937 11 1975 629 407 497 287 344 661 661 12 1976 1077 1062 1185 1201 1963 1282 1963 13 1977 811 736 520 407 742 601 811 14 1978 879 905 564 416 416 1131 1131 15 1979 1006 875 778 746 1171 726 1171 16 1980 1085 1302 1069 504 580 740 1302 17 1981 894 906 561 574 413 1589 1589 18 1982 1245 1117 940 710 613 1152 1245 19 1983 2227 3328 1652 1055 2956 2299 3328 20 1984 1124 625 521 649 657 544 1124 21 1985 1020 749 619 517 687 705 1020 22 1986 1121 663 669 908 446 364 1121 23 1987 1021 782 594 474 863 545 1021 . Set.

24 1988 826 835 478 414 341 849 849 25 1989 663 647 577 670 575 622 670 26 1990 745 473 496 475 660 586 745 27 1991 1752 745 648 464 490 1023 1752 28 1992 1560 707 885 475 1111 1079 1560 29 1993 885 922 556 471 745 874 922 30 1994 1896 701 509 404 304 414 1896 31 1995 963 569 544 352 342 1178 1178 32 1996 754 547 574 488 1357 655 1357 33 1997 950 1139 649 487 496 680 1139 34 1998 806 924 410 456 301 819 924 35 1999 644 596 453 324 359 279 644 36 2000 615 541 512 499 875 363 875 37 2001 504 357 276 267 465 681 681 38 2002 713 518 451 394 438 403 713 39 2003 798 540 536 403 304 646 798 40 2004 1093 980 716 463 432 659 1093 41 2005 2239 1017 686 549 583 811 2239 42 2006 654 584 525 464 526 708 708 43 2007 758 675 815 516 305 629 815 44 2008 958 699 648 511 637 685 958 45 2009 987 825 906 768 1082 1523 1523 46 2010 644 557 563 354 528 613 644 47 2011 874 789 544 449 331 873 874 48 2012 957 1256 635 396 296 378 1256 49 2013 1030 993 675 462 404 776 1030 50 2014 324 298 320 279 194 157 324 51 2015 545 481 285 236 1020 250 1020 52 2016 172 193 115 94 107 123 193 53 2017 207 160 98 78 65 175 207 > .

5874 1239.9510 608.5944 [15] 1232.6014 1012.6224 770.3706 1004.9930 872.9720 [22] 997.8951 909.9371 [8] 1621.3916 1049.3007 4658.0769 960.6364 1026.7273 1386.1818 1452.0699 1995.> max<-dados$Max[1:29] > max [1] 1946 1372 1049 731 807 945 899 1222 807 937 661 1963 811 1131 1171 [16] 1302 1589 1245 3328 1124 1020 1121 1021 849 670 745 1752 1560 922 > > library(evd) > library(MASS) > library(EnvStats) > library(Kendall) > library(POT) > library(evdbayes) > library(R2OpenBUGS) > library(coda) > library(goftest) > > k=median(max)/median(max0) >k [1] 7.5385 1166.335664 > > > maxc<-k*(max0) > maxc [1] 1694.2448 850.shape=0) ###função verossimilhança gumbel > mg1 .3217 1870.4615 894.4406 [29] 1049.0000 1269.9860 718.1469 1291.6503 953.8601 1892.9441 799.0000 > > mg1<-fgev(maxc.

sc1)$p.2] .1 [1] 0.1] [.test(maxc.7 Standard Errors loc scale 69.Call: fgev(x = maxc.2 362.cov [.5031777 > mg1$var.6893 > ad.64 57. shape = 0) Deviance: 438.lc1.158 > > sc1<-(mg1)[[1]][2:2] > sc1 scale 362.9162 Estimates loc scale 1046.62 Optimization Information Convergence: successful Function Evaluations: 10 Gradient Evaluations: 6 > > lc1<-(mg1)[[1]][1:1] > lc1 loc 1046.value > ad.1<-ad. pgumbel.

454 > > v.454 > > vrlc0=(v.939 3320.1] [.939 scale 1135.939 scale 1135.951 1135.c1)[[4]] > vrsc0 [1] 3320.c1)[[9]] : índice fora de limites > vrxi0 Erro: objeto 'vrxi0' não encontrado > varlc=1*vrlc0 > varlc [1] 4849.454 > > vrxi0=(v.951 > > t0lc=1/varlc > > t0lc=1/varlc > t0lc [1] 0.c1)[[9]] Error in (v.c1<-mg1$var.0002061877 > .c1 [.loc 4849.939 3320.2] loc 4849.c1)[[1]] > vrlc0 [1] 4849.951 1135.cov > v.951 > > vrsc0=(v.

0003011637 > > sink("gumbel. sigma) + } + + # Prior + # dnorm(media.txt") > cat(" + model { + + # Verossimilhança + for (i in 1:n) { + y[i] ~ dgumbel(mu.mu .mu . precisao) + mu ~ dnorm(1046.(sigma)*log(-log(1-(1/18))) + yp24 <.(sigma)*log(-log(1-(1/3))) + yp6 <.0.0.0003) + + yp3 <.(sigma)*log(-log(1-(1/9))) + yp18 <.mu .0002) + sigma ~ dnorm(363.fill=TRUE) > sink() > .(sigma)*log(-log(1-(1/6))) + yp9 <.> > varsc=1*vrsc0 > > t0sc=1/varsc > t0sc [1] 0.(sigma)*log(-log(1-(1/24))) + + } + ".mu .mu .

21 Optimization Information Convergence: successful Function Evaluations: 13 Gradient Evaluations: 9 > > inits <.function(){list(mu=850. shape = 0) Deviance: 429.list(y=max.6 Standard Errors loc scale 60. sigma=300)} .97 49.shape=0) > m1 Call: fgev(x = max.> > dados_bug<.9273 Estimates loc scale 991.n=length(max)) > dados_bug $y [1] 1946 1372 1049 731 807 945 899 1222 807 937 661 1963 811 1131 1171 [16] 1302 1589 1245 3328 1124 1020 1121 1021 849 670 745 1752 1560 922 $n [1] 29 > m1=fgev(max.4 315.

burnin = nb."sigma") > > nc = 2 #Numero de cadeias > ni = 40000 #Tamanho da cadeira > nb = 10000 #Numero de simulação que serão descartadas > nt = 10 > # Inicie o Amostrador > > > gumbel.inf = bugs(data = dados_bug.matrix[.3697 0.> params <."yp6". n."yp9". + parameters =c(params.inf$sims.inf<-as.9576 1.1 Fraction in 2nd window = 0.mcmc(gumbel.6421 1.8384 1.5 mu sigma yp3 yp6 yp9 yp18 yp24 deviance 2.chains = nc. n. inits = inits.inf) Fraction in 1st window = 0.9272 2.2408 1. + n.txt". + model = "gumbel.iter = ni."yp24").6920 1.c("mu". + n."yp3".3966 > nc = 2 #Numero de cadeias . codaPkg=FALSE.]) # salva a saída como cadeia mcmc > > > > > geweke. debug=T) > > > > post_g."yp18".diag(post_g.thin = nt.

1 Fraction in 2nd window = 0.95 .81399 0.0.chains = nc.98397 0.inf) Fraction in 1st window = 0.73564 0. n."yp3". + model = "gumbel.005 Probability (s) = 0.matrix[.iter = ni. + n. inits = inits.09901 0.]) # salva a saída como cadeia mcmc > > geweke. codaPkg=FALSE. n."yp18". debug=T) > > > > post_g.diag(post_g. + parameters =c(params.inf = bugs(data = dados_bug.26679 > raftery.> ni = 60000 #Tamanho da cadeira > nb = 15000 #Numero de simulação que serão descartadas > nt = 10 > > # Inicie o Amostrador > > > gumbel.inf$sims.025 Accuracy (r) = +/.inf<-as.45479 0.mcmc(gumbel.txt". + n.diag(post_g.thin = nt."yp9".5 mu sigma yp3 yp6 yp9 yp18 yp24 deviance -0."yp6".66537 0.burnin = nb.inf) Quantile (q) = 0.79454 0."yp24").

inf.sims = 90000 iterations saved mean sd 2.9 426.996 yp9 2 3760 3746 1.640 > > HPD.5% Rhat n.997 yp24 2 3747 3746 1.5% 25% 50% 75% 97."Probability") [1] 0.0 yp9 1563.020 yp6 2 3732 3746 0. Current: 2 chains.95 > > resumo1=print(gumbel.0 sigma 270.dig=3) # salva a resumo da cadeia mcmc com 3 dígitos Inference for Bugs model at "gumbel.0 1976.7 yp3 1207. each with 60000 iterations (first 15000 discarded).0 yp18 1752.eff .0 2269.inf) > HPD.inf=HPDinterval(post_g.0 1790.010 sigma 2 3793 3746 1.txt". n.0 yp6 1437.inf lower upper mu 924.thin = 10 Cumulative: n.000 deviance 2 9880 3746 2.0 deviance 429. Burn-in Total Lower bound Dependence (M) (N) (Nmin) factor (I) mu 2 3766 3746 1.010 yp3 2 3808 3746 1.0 attr(.0 1460.000 yp18 2 3733 3746 0.0 yp24 1834.2 1110.0 2394.9 434.

001 3500 For each parameter.003 780 sigma 348.893 65.893 1611. Rhat=1).407 1.0 434.584 1442.0 1609.519 2119.0 1464.428 > > > maxf<-dados$Max[30:53] > > obs1_1<-max(maxf[1:3]) > obs1_1 [1] 1896 > obs1_2<-max(maxf[1:6]) .8 347.908 47.0 2019. pD = Dbar-Dhat) pD = 1.0 2214.002 1300 yp9 1764.930 40.4 431.400 DIC is an estimate of expected predictive error (lower deviance is better).0 1548.5 320.0 1112.0 1.VP1 [1] 1332.238 2016.0 1.0 430.999 1566.0 1287.0 2115.797 1852.eff is a crude measure of effective sample size.428 143.7 1018.3 432.4 375.0 1690.314 430.111 275.4 985.0 1.519 132.0 2104.002 1500 yp18 2016.0 1672.2 1.002 1900 deviance 431.mu 1017.0 2414.numeric(ypred1).782 1764.002 1800 yp24 2119.0 1797.0 1924. n.006 and DIC = 432.0 1.003 910 yp6 1611.0 1.238 105.0 1981. > > #resumo1 > #Preditiva > ypred1<-resumo1$mean[3:7] #salva as médias do y predito objeto"ypredl" > > > VP1 = as.0 1.0 1050. DIC info (using the rule.782 90.0 1331.0 2012.001 6900 yp3 1332.8 1. and Rhat is the potential scale reduction factor (at convergence.0 2288.210 1211.662 1769.0 1761.0 1376.0 1834.1 432.535 925.

shape = 0.38 > q_gum1<.9 Standard Errors .1=round(mean(EpG1)*100.0 321.> obs1_2 [1] 1896 > obs1_3<-max(maxf[1:9]) > obs1_3 [1] 1896 > obs1_4<-max(maxf[1:18]) > obs1_4 [1] 2239 > obs1_5<-max(maxf[1:24]) > obs1_5 [1] 2239 > > obs<-c(obs1_1.inf.2) .fgev(max.obs1_4.obs1_2.obs1_5) > obs [1] 1896 1896 1896 2239 2239 > > EpG1= abs((obs-VP1)/obs) > #round(EpGEVT*100.1 [1] 13.9464 Estimates quantile scale 1286.inf.ep. prob = 1/3) Deviance: 429.shape=0) #nível de retorno > q_gum1 Call: fgev(x = max.2) > ep.obs1_3.prob=1/3.

7 323.fgev(max.95 51.86 Optimization Information Convergence: successful Function Evaluations: 37 Gradient Evaluations: 35 > > q_gum3<. shape=0) #nível de retorno > q_gum2 Call: fgev(x = max. prob = 1/6) Deviance: 429.33 Optimization Information Convergence: successful Function Evaluations: 19 Gradient Evaluations: 16 > > q_gum2<. shape = 0.fgev(max.prob=1/9.50 51.shape=0) #nível de retorno > q_gum3 .prob=1/6.9556 Estimates quantile scale 1546.4 Standard Errors quantile scale 122.quantile scale 87.

shape = 0.prob=1/18. prob = 1/18) Deviance: 429.0 315.88 Optimization Information Convergence: successful Function Evaluations: 46 Gradient Evaluations: 44 > > q_gum4<.74 49. shape = 0.8 Standard Errors quantile scale 168.36 52.9808 Estimates quantile scale 1696.5 Standard Errors quantile scale 145.Call: fgev(x = max.37 .9255 Estimates quantile scale 1893.fgev(max.shape=0) #nível de retorno > q_gum4 Call: fgev(x = max. prob = 1/9) Deviance: 429.8 326.

9309 Estimates quantile scale 1998.Optimization Information Convergence: successful Function Evaluations: 55 Gradient Evaluations: 53 > > q_gum5<. prob = 1/24) Deviance: 429.9 319.fgev(max.prob=1/24.35 50.shape=0) #nível de retorno > q_gum5 Call: fgev(x = max.45 Optimization Information Convergence: successful Function Evaluations: 31 Gradient Evaluations: 29 > > > obs1_1<-max(maxf[1:3]) > obs1_1 [1] 1896 . shape = 0.2 Standard Errors quantile scale 186.

> obs1_2<-max(maxf[1:6]) > obs1_2 [1] 1896 > obs1_3<-max(maxf[1:9]) > obs1_3 [1] 1896 > obs1_4<-max(maxf[1:18]) > obs1_4 [1] 2239 > obs1_5<-max(maxf[1:24]) > obs1_5 [1] 2239 > > obs<-c(obs1_1.obs1_4.972 > > q2<-(q_gum2)[[1]][1:1] > q2 quantile 1546.751 .obs1_3.obs1_5) > obs [1] 1896 1896 1896 2239 2239 > > q1<-(q_gum1)[[1]][1:1] > q1 quantile 1285.obs1_2.704 > > q3<-(q_gum3)[[1]][1:1] > q3 quantile 1696.

1842280 0.1050892 0.972 1546.751 1892.3217447 0.nao.968 > > q5<-(q_gum5)[[1]][1:1] > q5 quantile 1998.1072184 > > mean(epag1) [1] 0.45655 > > > sink("Gumbel.q3.q5) > nr1 quantile quantile quantile quantile quantile 1285.> > q4<-(q_gum4)[[1]][1:1] > q4 quantile 1892.1545474 0.704 1696.938 > > nr1<-c(q1. ep.1745655 > > ep.938 > epag1=abs((obs-nr1)/obs) > epag1 quantile quantile quantile quantile quantile 0.inf_1.txt") > cat(" + model { + .q4.q2.968 1998.vero [1] 17.vero=mean(epag1)*100 .

mu .list(y=max. sigma) + } + + # Prior + # dnorm(media.(sigma)*log(-log(1-(1/18))) + yp24 <.(sigma)*log(-log(1-(1/24))) + + } + ".c("mu".+ # Verossimilhança + for (i in 1:n) { + y[i] ~ dgumbel(mu."sigma") .10000000) + sigma ~ dunif(0.(sigma)*log(-log(1-(1/3))) + yp6 <.(sigma)*log(-log(1-(1/9))) + yp18 <.(sigma)*log(-log(1-(1/6))) + yp9 <.mu . precisao) + mu ~ dunif(0.mu .mu .mu .n=length(max)) > dados_bug $y [1] 1946 1372 1049 731 807 945 899 1222 807 937 661 1963 811 1131 1171 [16] 1302 1589 1245 3328 1124 1020 1121 1021 849 670 745 1752 1560 922 $n [1] 29 > inits <. sigma=300)} > params <.function(){list(mu=850.8000) + # Para Fazer preditiva + yp3 <.fill=TRUE) > sink() > > dados_bug<.

mcmc(gumbel. debug=T) > > > > post_g.> > nc = 2 #Numero de cadeias > ni = 35000 #Tamanho da cadeira > nb = 7000 #Numero de simulação que serão descartadas > nt = 10 > > > # Inicie o Amostrador > > > gumbel.20159 > raftery.nao. + model = "Gumbel.matrix[.chains = nc. + n."yp3".ninf) Fraction in 1st window = 0.40946 -0. n.]) # salva a saída como cadeia mcmc > > > geweke.diag(post_g.43373 -0.ninf) .inf_1.burnin = nb. + n.1 Fraction in 2nd window = 0.ninf$sims.iter = ni."yp9"."yp18".txt".5 mu sigma yp3 yp6 yp9 yp18 yp24 deviance 0.ninf = bugs(data = dados_bug. + parameters =c(params.63377 -0. n.ninf<-as.06401 -0.diag(post_g.33991 -0.27832 -0.43014 -0.thin = nt. codaPkg=FALSE. inits = inits."yp6"."yp24").

010 deviance 2 7992 3746 2.253 sigma passed 1 0.010 yp9 2 3785 3746 1.000 yp24 2 3793 3746 1.997 sigma 2 3745 3746 1.130 > heidel.ninf) Stationarity start p-value test iteration mu passed 1 0.203 yp3 passed 1 0.010 yp18 2 3750 3746 1.025 Accuracy (r) = +/.224 yp9 passed 1 0.235 yp6 passed 1 0.diag(post_g.Quantile (q) = 0.020 yp6 1 3776 3746 1.000 yp3 2 3831 3746 1.005 Probability (s) = 0.214 yp24 passed 1 0.569 Halfwidth Mean Halfwidth test mu passed 990 0.0.214 deviance passed 1 0.95 Burn-in Total Lower bound Dependence (M) (N) (Nmin) factor (I) mu 2 3734 3746 0.218 yp18 passed 1 0.5499 .

4 attr(.eff mu 989.7302 deviance passed 432 0.0 1830.0 yp6 1330.38 152.5 945. n.0 1 56000 sigma 342.sims = 56000 iterations saved mean sd 2.00 1650.2790 yp18 passed 1969 1.1 472.7790 yp6 passed 1572 1.55 375.3 1 56000 yp3 1298.0 2064.5 455.0 1 56000 yp9 1721.95 > > resumo2=print(gumbel.0 2481.53 1467.00 1812.0 1123. each with 35000 iterations (first 7000 discarded).64 67.0 2021.68 1136.0 2350.dig=2) # salva a resumo da cadeia mcmc com 3 dígitos Inference for Bugs model at "Gumbel.0 1863.nao.0 1233.ninf.0 1291.sigma passed 342 0.00 1356.nao.dig=1) > HPD.0 sigma 239.0 1559.inf lower upper mu 858.0 1 56000 .0 deviance 429.thin = 10 Cumulative: n.0 1 56000 yp6 1571.0 yp18 1623.inf_1.0 1504.10 858.4 yp3 1118.5% Rhat n.0 yp24 1693.nao.0 1480.90 130.5 301.0 1706.txt".inf=HPDinterval(post_g.0 1614.0 1480.0 yp9 1438.0939 yp9 passed 1721 1."Probability") [1] 0.00 1034.0179 > HPD.ninf .6 335.2 989. Current: 2 chains.47 93.9 436.39 1352.11 57.5% 25% 50% 75% 97.5976 yp24 passed 2070 1.7 1123.4705 yp3 passed 1298 0.16 249.

numeric(ypred2).10 2.yp18 1968.729 2069.9 1 40000 For each parameter.0 437.91 and DIC = 434. Rhat=1).0 2048. DIC info (using the rule. n.0 1 56000 deviance 432. pD = Dbar-Dhat) pD = 1.621 > > maxf<-dados$Max[30:53] > > obs1_1<-max(maxf[1:3]) > obs1_1 [1] 1896 > obs1_2<-max(maxf[1:6]) > obs1_2 [1] 1896 > obs1_3<-max(maxf[1:9]) > obs1_3 [1] 1896 > obs1_4<-max(maxf[1:18]) > obs1_4 .377 1968.897 1721.0 1833. > > #Preditiva > > ypred2<-resumo2$mean[3:7] #salva as médias do y predito objeto"ypredl" > > VP2 = as.73 190.0 1 56000 yp24 2069.0 430.VP2 [1] 1298.17 430.eff is a crude measure of effective sample size.466 1571.00 2192. and Rhat is the potential scale reduction factor (at convergence.40 433.0 2535.00 DIC is an estimate of expected predictive error (lower deviance is better).0 1949.0 1923.0 2398.62 1729.70 1653.62 206.00 2081.6 431.

ep.mu .ninf [1] 15.mu .obs1_3.2) > ep.(sigma)*log(-log(1-(1/18))) .(sigma)*log(-log(1-(1/6))) + yp9 <.mu .49 > > sink("G.(sigma)*log(-log(1-(1/3))) + yp6 <.0.obs1_5) > obs [1] 1896 1896 1896 2239 2239 > EpG2= abs((obs-VP2)/obs) > #round(EpGEVT*100.obs1_2.inf_1.000001) + sigma ~ dnorm(0.000001) + # Para Fazer preditiva + + yp3 <.2) .obs1_4. precisao) + mu ~ dnorm(0.(sigma)*log(-log(1-(1/9))) + yp18 <. sigma) + } + + # Prior + # dnorm(media.nao.0.[1] 2239 > obs1_5<-max(maxf[1:24]) > obs1_5 [1] 2239 > obs<-c(obs1_1.txt") > cat(" + model { + + # Verossimilhança + for (i in 1:n) { + y[i] ~ dgumbel(mu.ninf=round(mean(EpG2)*100.mu .

+ yp24 <. inits = inits."sigma") > > nc = 2 #Numero de cadeias > ni = 35000 #Tamanho da cadeira > nb = 7000 #Numero de simulação que serão descartadas > nt = 10 > > gum. n.ninf) Fraction in 1st window = 0.c("mu".ninf<-as."yp9". + n.diag(post_g.mu ."yp6".nao.burnin = nb.function(){list(mu=850.(sigma)*log(-log(1-(1/24))) + + } + ".matrix[.5 mu sigma yp3 yp6 yp9 yp18 yp24 deviance .ninf = bugs(data = dados_bug. + n.iter = ni.thin = nt. sigma=300)} > params <.txt". + model = "G. + parameters =c(params.chains = nc."yp24"). codaPkg=FALSE.inf_1.]) # salva a saída como cadeia mcmc > > > geweke.ninf$sims."yp18".fill=TRUE) > sink() > > inits <.mcmc(gum."yp3". n. debug=T) > > > > post_g.1 Fraction in 2nd window = 0.

992 yp24 2 3790 3746 1.ninf) Stationarity start p-value test iteration mu passed 1 0.5713 0.7623 0.025 Accuracy (r) = +/.diag(post_g.738 yp18 passed 1 0.diag(post_g.779 yp24 passed 1 0.684 yp9 passed 1 0.473 yp6 passed 1 0.175 sigma passed 1 0. 1.000 yp9 2 3732 3746 0.9617 -0.170 > heidel.3453 0.700 yp3 passed 1 0.0.996 yp18 2 3715 3746 0.010 deviance 2 8113 3746 2.991 yp3 2 3782 3746 1.5156 1.785 deviance passed 1 0.010 sigma 2 3712 3746 0.010 yp6 1 3757 3746 1.126 .ninf) Quantile (q) = 0.1527 > raftery.005 Probability (s) = 0.9248 0.1681 1.95 Burn-in Total Lower bound Dependence (M) (N) (Nmin) factor (I) mu 2 3783 3746 1.

0 2447.0 1468.0169 > > HPD.0 yp18 1620.0 2318.inf_1.nao. n.sims = 56000 iterations saved mean sd 2.95 > > resumo2=print(gum.eff .2130 yp18 passed 1954 1.5355 sigma passed 338 0.1 1113.0 attr(.4552 yp3 passed 1291 0.0 1812.0 sigma 239. each with 35000 iterations (first 7000 discarded).thin = 10 Cumulative: n.0 yp6 1332.ninf .5% 25% 50% 75% 97.6 yp3 1122.dig=2) # salva a resumo da cadeia mcmc com 3 dígitos Inference for Bugs model at "G.txt".inf lower upper mu 860.dig=1) > HPD.ninf.9 436.0 yp24 1691.0 2000."Probability") [1] 0.nao.0 yp9 1440.0 deviance 429.5168 yp24 passed 2054 1.0370 yp9 passed 1710 1.inf=HPDinterval(post_g.nao. Halfwidth Mean Halfwidth test mu passed 986 0. Current: 2 chains.6435 deviance passed 432 0.5% Rhat n.7453 yp6 passed 1562 1.2 447.

941 > > maxf<-dados$Max[30:53] > > > > EpGev2= abs((obs-VP2)/obs) > #round(EpGEVT*100. ep.2) .00 1.00 3400 yp18 1954.06 > ni = 45000 #Tamanho da cadeira > nb = 10000 #Numero de simulação que serão descartadas .0 1486.00 1914.65 861.ninf [1] 16.01 620 For each parameter.21 1348.8 332.0 1284.0 2359.0 1797.00 1474.0 1696. DIC info (using the rule.833 1709.50 298.4 432.43 1721.48 89.02 1.94 198. and Rhat is the potential scale reduction factor (at convergence.7 460.eff is a crude measure of effective sample size.00 430.90 1.623 1954.7 986.0 1837.00 1. Rhat=1).99 1134. > > ypred2<-resumo2$mean[3:7] #salva as médias do y predito objeto"ypredl" > > VP2 = as.0 2494.0 2064.25 54.ninf=round(mean(EpGev2)*100.00 1.18 183.97 1825.482 1561.0 1347.0 1551.mu 986.62 146.VP2 [1] 1291.0 1637.0 2032.83 125.00 1500 yp3 1291.30 1.00 1.00 17000 yp6 1561.00 2500 deviance 431.00 4500 yp9 1709.0 2036.96 247.0 1115. n.00 1.0 1938.97 1606.2) > ep.46 1460.04 430.3 1028.80 DIC is an estimate of expected predictive error (lower deviance is better).13 1645.00 1229.85 and DIC = 433.9 371.5 431.20 943.0 2172.numeric(ypred2).00 2600 yp24 2053. pD = Dbar-Dhat) pD = 1.99 2.14 64.183 2053.8 437.00 9500 sigma 338.

debug=T) > > > > post_g."yp6".iter = ni.7600 0.6001 0.> nt = 10 > > > > # Inicie o Amostrador > > > gum. + parameters =c(params.5 mu sigma yp3 yp6 yp9 yp18 yp24 deviance 0.nao.ninf) Fraction in 1st window = 0.diag(post_g.burnin = nb.]) # salva a saída como cadeia mcmc > > > geweke. n.7095 0."yp9".chains = nc."yp24"). inits = inits."yp3".ninf = bugs(data = dados_bug.6803 > raftery.0. + n.8121 0.005 Probability (s) = 0.8394 0.matrix[. n.7892 0. codaPkg=FALSE.1 Fraction in 2nd window = 0.ninf) Quantile (q) = 0.7538 0. + n.ninf<-as.025 Accuracy (r) = +/.txt".thin = nt.diag(post_g.95 .ninf$sims.mcmc(gum."yp18". + model = "G.inf_1.

415 yp3 passed 1293 0.03 yp24 2 3823 3746 1.210 Halfwidth Mean Halfwidth test mu passed 986 0.470 deviance passed 1 0.491 sigma passed 340 0.696 sigma passed 1 0. Burn-in Total Lower bound Dependence (M) (N) (Nmin) factor (I) mu 2 3762 3746 1.454 yp9 passed 1 0.00 yp6 2 3771 3746 1.ninf) Stationarity start p-value test iteration mu passed 1 0.01 yp9 2 3784 3746 1.467 yp24 passed 1 0.945 .477 yp6 passed 1 0.678 yp6 passed 1565 0.458 yp18 passed 1 0.01 yp18 2 3868 3746 1.08 > heidel.01 yp3 2 3764 3746 1.02 deviance 2 7797 3746 2.00 sigma 2 3775 3746 1.549 yp3 passed 1 0.diag(post_g.

0 1 3600 sigma 340.0 2048.00 1828.015 > > > HPD.50 300.0 2463.74 860.43 186.0 334.inf_1.ninf.inf lower upper mu 857.5% 25% 50% 75% 97.eff mu 986.0 1942.thin = 10 Cumulative: n.20 942.0 1471.106 yp18 passed 1959 1.95 > > resumo2=print(gum.97 1609.0 yp9 1434.0 1700.0 1 16000 yp9 1713.nao.5% Rhat n.3 373.0 1029.95 127.inf=HPDinterval(post_g.dig=2) # salva a resumo da cadeia mcmc com 3 dígitos Inference for Bugs model at "G.0 1 24000 yp18 1959.4 1114. Current: 2 chains.0 2069.383 yp24 passed 2060 1.sims = 70000 iterations saved mean sd 2.3 1 70000 yp3 1293.9 436.07 248.0 1819.0 1850.13 91.0 2003.0 1494.499 deviance passed 432 0.0 1553. n.59 1136.0 1 45000 .23 1463.67 1649.0 2379.txt".0 2331.3 453.0 1802.0 yp18 1620.ninf .3 986.0 yp24 1693. each with 45000 iterations (first 10000 discarded).54 1350.0 yp6 1332.13 65.0 1349.0 sigma 241.97 1475.0 deviance 429.1 attr(.4 467.yp9 passed 1714 1.0 1118.08 56.0 1286."Probability") [1] 0.dig=1) > HPD.nao.nao.0 1641.0 1 7300 yp6 1564.7 yp3 1120.54 149.00 1229.

eff is a crude measure of effective sample size.726 > > maxf<-dados$Max[30:53] > > obs1_1<-max(maxf[1:3]) > obs1_1 [1] 1896 > obs1_2<-max(maxf[1:6]) > obs1_2 [1] 1896 > obs1_3<-max(maxf[1:9]) > obs1_3 [1] 1896 > obs1_4<-max(maxf[1:18]) > obs1_4 [1] 2239 > obs1_5<-max(maxf[1:24]) > obs1_5 .yp24 2059.0 2179. pD = Dbar-Dhat) pD = 1.00 1917.28 1724.00 430.04 2. n.428 2059.6 431.90 DIC is an estimate of expected predictive error (lower deviance is better).949 1713. DIC info (using the rule. > > ypred2<-resumo2$mean[3:7] #salva as médias do y predito objeto"ypredl" > > VP2 = as.0 2514.0 1 57000 deviance 432.4 432.6 1 4100 For each parameter. and Rhat is the potential scale reduction factor (at convergence.9 437.numeric(ypred2).10 430.131 1564.541 1959. Rhat=1).0 2041.VP2 [1] 1293.73 202.87 and DIC = 433.

7 yp3 1120.0 deviance 429.0 2331. ep.0 1471.0 yp6 1332.87 > .0 yp18 1620.obs1_3.obs1_4.95 > > > obs<-c(obs1_1.9 436.obs1_2.0 1819.1 attr(.inf lower upper mu 857.0 yp9 1434.2) > ep.obs1_5) > obs [1] 1896 1896 1896 2239 2239 > HPD.ninf=round(mean(EpGev2)*100.4 1114.0 2003.0 sigma 241.0 yp24 1693.0 2463.nao.obs1_3.obs1_4."Probability") [1] 0.3 453.2) .[1] 2239 > > obs<-c(obs1_1.ninf [1] 15.obs1_5) > obs [1] 1896 1896 1896 2239 2239 > > > EpGev2= abs((obs-VP2)/obs) > #round(EpGEVT*100.obs1_2.

185 .604 1786.685 > ic30 [1] 1633.252 2223.804 > ic10 [1] 1411.358 > ic5 [1] 1306.691 2364.> ic2 [1] 1113.586 1458.660 > ic20 [1] 1562.842 1981.