Os dados em questão são referentes a quantidade de crianças atendidas em alguma unidade de saúde no munícipio de Campina Grande - PB, com variáveis a respeito da qualidade da água que abastece a cidade.
| ANO_MES | Qtd_c | VOLUME | Ph | COR | TURBIDEZ | CLORO | CLORETO | Coli |
|---|---|---|---|---|---|---|---|---|
| jan/06 | 326 | 87.3 | 7.7 | 5.9 | 0.9 | 1.4 | 81.2 | N |
| fev/06 | 199 | 85.8 | 7.7 | 5.6 | 0.9 | 1.6 | 78.4 | N |
| mar/06 | 239 | 85.7 | 7.6 | 5.1 | 1.0 | 1.6 | 79.4 | N |
| abr/06 | 356 | 94.4 | 7.6 | 5.6 | 0.8 | 1.4 | 83.6 | N |
| mai/06 | 540 | 100.0 | 7.4 | 6.5 | 1.3 | 1.4 | 83.6 | N |
| jun/06 | 241 | 100.0 | 7.1 | 11.3 | 2.6 | 1.6 | 80.6 | N |
| jul/06 | 319 | 100.0 | 7.2 | 7.2 | 1.3 | 1.6 | 74.7 | N |
| ago/06 | 605 | 99.6 | 7.2 | 5.0 | 0.9 | 1.6 | 72.4 | N |
| set/06 | 385 | 97.0 | 7.2 | 5.2 | 0.8 | 1.6 | 75.3 | N |
| out/06 | 287 | 94.3 | 7.3 | 7.4 | 0.6 | 1.5 | 77.2 | N |
| Qtd_c | VOLUME | Ph | COR | TURBIDEZ | CLORO | CLORETO | |
|---|---|---|---|---|---|---|---|
| nobs | 132.00 | 132.00 | 132.00 | 132.00 | 132.00 | 132.00 | 132.00 |
| NAs | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| Minimum | 60.00 | 4.80 | 6.20 | 1.40 | 0.37 | 0.00 | 41.70 |
| Maximum | 1367.00 | 100.00 | 45.50 | 25.72 | 6.58 | 5.00 | 532.10 |
| 1. Quartile | 206.50 | 32.38 | 7.30 | 4.55 | 0.87 | 1.00 | 95.75 |
| 3. Quartile | 439.50 | 94.30 | 7.70 | 8.60 | 1.58 | 1.60 | 316.85 |
| Mean | 353.73 | 66.53 | 7.77 | 6.94 | 1.39 | 1.52 | 205.78 |
| Median | 300.50 | 84.75 | 7.57 | 6.15 | 1.12 | 1.30 | 155.90 |
| Sum | 46693.00 | 8782.10 | 1025.97 | 916.24 | 182.84 | 201.28 | 27162.30 |
| SE Mean | 19.05 | 2.89 | 0.29 | 0.33 | 0.08 | 0.09 | 10.79 |
| LCL Mean | 316.05 | 60.81 | 7.20 | 6.29 | 1.24 | 1.34 | 184.44 |
| UCL Mean | 391.42 | 72.25 | 8.34 | 7.59 | 1.54 | 1.71 | 227.11 |
| Variance | 47898.03 | 1105.00 | 11.04 | 14.29 | 0.76 | 1.15 | 15354.62 |
| Stdev | 218.86 | 33.24 | 3.32 | 3.78 | 0.87 | 1.07 | 123.91 |
| Skewness | 1.54 | -0.62 | 11.09 | 1.94 | 2.87 | 2.00 | 0.65 |
| Kurtosis | 3.37 | -1.24 | 123.02 | 6.45 | 11.28 | 3.74 | -0.82 |
Analisando a variável Coli:
Utilizando o método de métodos das Médias Móveis, com um lag
igual a 6:
A partir da função forecast podemos estimar o valor do pH para Outubro de 2015:
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## 118 7.63122 7.303683 7.958758 7.130295 8.132146
Substituindo esse valor nos dados:
Modelo
##
## Call:
## tsglm(ts = ts_0_9, model = list(past_obs = 1, past_mean = 13),
## xreg = ts_var, link = "log", distr = "nbinom")
##
## Coefficients:
## Estimate Std.Error CI(lower) CI(upper)
## (Intercept) 2.31291 0.58995 1.15663 3.469183
## beta_1 0.67867 0.07891 0.52402 0.833333
## alpha_13 -0.03739 0.08546 -0.20489 0.130115
## VOLUME -0.00306 0.00122 -0.00545 -0.000671
## sigmasq 0.14650 NA NA NA
## Standard errors and confidence intervals (level = 95 %) obtained
## by normal approximation.
##
## Link function: log
## Distribution family: nbinom (with overdispersion coefficient 'sigmasq')
## Number of coefficients: 5
## Log-likelihood: -808.0073
## AIC: 1626.015
## BIC: 1640.429
## QIC: 7423.146
Verificando o Ajuste
Gráfico
Modelo
##
## Call:
## tsglm(ts = ts_0_9, model = list(past_obs = 1, past_mean = 13),
## xreg = ts_var, link = "log", distr = "nbinom")
##
## Coefficients:
## Estimate Std.Error CI(lower) CI(upper)
## (Intercept) 5.6315 0.9058 3.856 7.4069
## beta_1 0.4445 0.0672 0.313 0.5762
## alpha_13 -0.0985 0.0744 -0.244 0.0473
## Ph -0.2333 0.1370 -0.502 0.0353
## sigmasq 0.1954 NA NA NA
## Standard errors and confidence intervals (level = 95 %) obtained
## by normal approximation.
##
## Link function: log
## Distribution family: nbinom (with overdispersion coefficient 'sigmasq')
## Number of coefficients: 5
## Log-likelihood: -837.3023
## AIC: 1684.605
## BIC: 1699.019
## QIC: 10870.98
Verificando o Ajuste
Gráfico
Modelo
##
## Call:
## tsglm(ts = ts_0_9, model = list(past_obs = 1, past_mean = 13),
## xreg = ts_var, link = "log", distr = "nbinom")
##
## Coefficients:
## Estimate Std.Error CI(lower) CI(upper)
## (Intercept) 1.2868 0.5415 0.2255 2.3480
## beta_1 0.7826 0.0747 0.6361 0.9290
## alpha_13 0.0104 0.0905 -0.1671 0.1878
## COR -0.0069 0.0104 -0.0273 0.0135
## sigmasq 0.1638 NA NA NA
## Standard errors and confidence intervals (level = 95 %) obtained
## by normal approximation.
##
## Link function: log
## Distribution family: nbinom (with overdispersion coefficient 'sigmasq')
## Number of coefficients: 5
## Log-likelihood: -811.7259
## AIC: 1633.452
## BIC: 1647.866
## QIC: 7922.617
Verificando o Ajuste
Gráfico
Modelo
##
## Call:
## tsglm(ts = ts_0_9, model = list(past_obs = 1, past_mean = 13),
## xreg = ts_var, link = "log", distr = "nbinom")
##
## Coefficients:
## Estimate Std.Error CI(lower) CI(upper)
## (Intercept) 1.400384 0.5609 0.301 2.4997
## beta_1 0.769270 0.0730 0.626 0.9124
## alpha_13 0.000703 0.0923 -0.180 0.1815
## TURBIDEZ -0.017777 0.0439 -0.104 0.0682
## sigmasq 0.160085 NA NA NA
## Standard errors and confidence intervals (level = 95 %) obtained
## by normal approximation.
##
## Link function: log
## Distribution family: nbinom (with overdispersion coefficient 'sigmasq')
## Number of coefficients: 5
## Log-likelihood: -811.5445
## AIC: 1633.089
## BIC: 1647.503
## QIC: 7903.594
Verificando o Ajuste
Gráfico
Modelo
##
## Call:
## tsglm(ts = ts_0_9, model = list(past_obs = 1, past_mean = 13),
## xreg = ts_var, link = "log", distr = "nbinom")
##
## Coefficients:
## Estimate Std.Error CI(lower) CI(upper)
## (Intercept) 1.468787 0.5673 0.3568 2.5807
## beta_1 0.759892 0.0732 0.6165 0.9033
## alpha_13 -0.000333 0.0918 -0.1802 0.1795
## CLORO -0.020234 0.0364 -0.0916 0.0511
## sigmasq 0.158208 NA NA NA
## Standard errors and confidence intervals (level = 95 %) obtained
## by normal approximation.
##
## Link function: log
## Distribution family: nbinom (with overdispersion coefficient 'sigmasq')
## Number of coefficients: 5
## Log-likelihood: -811.3673
## AIC: 1632.735
## BIC: 1647.149
## QIC: 7868.411
Verificando o Ajuste
Gráfico
Modelo
##
## Call:
## tsglm(ts = ts_0_9, model = list(past_obs = 1, past_mean = 13),
## xreg = ts_var, link = "log", distr = "nbinom")
##
## Coefficients:
## Estimate Std.Error CI(lower) CI(upper)
## (Intercept) 1.616711 0.584892 4.70e-01 2.76308
## beta_1 0.709379 0.076182 5.60e-01 0.85869
## alpha_13 -0.001884 0.098959 -1.96e-01 0.19207
## CLORETO 0.000586 0.000326 -5.33e-05 0.00123
## sigmasq 0.149758 NA NA NA
## Standard errors and confidence intervals (level = 95 %) obtained
## by normal approximation.
##
## Link function: log
## Distribution family: nbinom (with overdispersion coefficient 'sigmasq')
## Number of coefficients: 5
## Log-likelihood: -809.1632
## AIC: 1628.326
## BIC: 1642.74
## QIC: 7494.836
Verificando o Ajuste
Gráfico
Modelo
##
## Call:
## tsglm(ts = ts_0_9, model = list(past_obs = 1, past_mean = 13),
## xreg = ts_var, link = "log", distr = "nbinom")
##
## Coefficients:
## Estimate Std.Error CI(lower) CI(upper)
## (Intercept) 1.37288 0.5955 0.206 2.540
## beta_1 0.75856 0.0792 0.603 0.914
## alpha_13 0.00305 0.0973 -0.188 0.194
## Coli 0.04572 0.1080 -0.166 0.257
## sigmasq 0.15769 NA NA NA
## Standard errors and confidence intervals (level = 95 %) obtained
## by normal approximation.
##
## Link function: log
## Distribution family: nbinom (with overdispersion coefficient 'sigmasq')
## Number of coefficients: 5
## Log-likelihood: -810.956
## AIC: 1631.912
## BIC: 1646.326
## QIC: 7851.867
Verificando o Ajuste