UNIVERSIDADE FEDERAL FLUMINENSE
ESCOLA DE ENGENHARIA
PROGRAMA DE PÓS-GRADUAÇÃO EM ENGENHARIA CIVIL
Trabalho Final de Estatística
ANALISE COMPARATIVA DOS AFASTAMENTOS OCUPACIONAIS
Aluno:EMMANUEL SADER FILHO
Disciplina: Estatística Aplicada à Engenharia
Docente: STEVEN DUT ROSS
Matrícula: M015.220.004
Niterói
2021
library(readxl)
AcidentesCNAE <- read_excel("D:/MESTRADO UFF 2020/Academico 2020/CIVIL/Estatistica/Artigo Steven/AcidentesCNAE.xls")
library(kableExtra)
kable(AcidentesCNAE, row.names = FALSE)%>%
kable_styling( full_width = T,bootstrap_options = c("striped", "hover", "condensed", "responsive"),
position = "center", fixed_thead = T) %>%
scroll_box(width = "900px", height = "600px")
| CNAE | Artesanal-Industrial | Incidencia | Doenca_Ocupacional | Acidentes_Típicos | Incapacidade | Mortalidade | Letalidade | Acidentes-16-34-anos |
|---|---|---|---|---|---|---|---|---|
| 0111 | 0 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| 0113 | 0 | 9.55 | 0.00 | 4.78 | 9.55 | 0.00 | 0.00 | 50.00 |
| 0116 | 0 | 1.31 | 0.00 | 1.31 | 1.31 | 0.00 | 0.00 | 0.00 |
| 0121 | 0 | 1.96 | 0.00 | 1.96 | 1.96 | 0.00 | 0.00 | 33.33 |
| 0122 | 0 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| 0133 | 0 | 6.14 | 0.00 | 6.14 | 6.14 | 0.00 | 0.00 | 0.00 |
| 0134 | 0 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| 0139 | 0 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| 0151 | 0 | 2.24 | 0.13 | 1.98 | 2.24 | 0.00 | 0.00 | 29.41 |
| 0152 | 0 | 5.56 | 0.00 | 3.71 | 5.56 | 0.00 | 0.00 | 66.67 |
| 0155 | 0 | 9.51 | 0.00 | 5.94 | 9.51 | 0.00 | 0.00 | 62.50 |
| 0159 | 0 | 3.14 | 0.00 | 3.14 | 0.00 | 0.00 | 0.00 | 0.00 |
| 0161 | 0 | 1.48 | 0.00 | 1.32 | 1.48 | 0.00 | 0.00 | 22.22 |
| 0162 | 0 | 0.50 | 0.00 | 0.00 | 0.50 | 0.00 | 0.00 | 0.00 |
| 0210 | 0 | 31.73 | 0.00 | 31.73 | 31.73 | 0.00 | 0.00 | 25.00 |
| 0220 | 0 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| 0230 | 0 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| 0311 | 1 | 0.88 | 0.00 | 0.88 | 1.77 | 88.30 | 1000.00 | 100.00 |
| 0322 | 1 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| 0600 | 1 | 19.42 | 0.14 | 16.78 | 5.41 | 0.00 | 0.00 | 28.93 |
| 0710 | 1 | 17.59 | 0.00 | 8.79 | 5.86 | 0.00 | 0.00 | 33.33 |
| 0810 | 1 | 15.16 | 0.66 | 10.54 | 12.85 | 0.00 | 0.00 | 30.43 |
| 0892 | 0 | 23.31 | 0.00 | 16.31 | 20.97 | 0.00 | 0.00 | 60.00 |
| 0893 | 1 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| 0910 | 1 | 21.19 | 0.84 | 16.69 | 7.11 | 28.16 | 13.29 | 50.83 |
| 1011 | 1 | 12.55 | 0.00 | 9.41 | 12.10 | 0.00 | 0.00 | 35.71 |
| 1012 | 0 | 8.73 | 0.26 | 5.39 | 8.47 | 0.00 | 0.00 | 52.94 |
| 1013 | 1 | 21.59 | 0.76 | 15.15 | 17.43 | 0.00 | 0.00 | 43.86 |
| 1020 | 1 | 22.01 | 0.00 | 11.65 | 22.01 | 0.00 | 0.00 | 47.06 |
| 1031 | 0 | 7.73 | 0.00 | 3.87 | 7.73 | 0.00 | 0.00 | 100.00 |
| 1032 | 1 | 13.81 | 0.00 | 13.81 | 13.81 | 0.00 | 0.00 | 66.67 |
| 1033 | 1 | 22.87 | 0.00 | 9.15 | 22.87 | 457.32 | 200.00 | 20.00 |
| 1051 | 1 | 8.02 | 0.00 | 4.81 | 8.02 | 0.00 | 0.00 | 80.00 |
| 1052 | 1 | 10.16 | 0.00 | 7.25 | 10.16 | 0.00 | 0.00 | 33.33 |
| 1053 | 1 | 7.48 | 0.00 | 6.73 | 6.73 | 0.00 | 0.00 | 40.00 |
| 1061 | 1 | 10.19 | 0.00 | 8.49 | 10.19 | 0.00 | 0.00 | 66.67 |
| 1062 | 1 | 13.88 | 0.00 | 11.10 | 13.88 | 0.00 | 0.00 | 80.00 |
| 1064 | 1 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| 1066 | 1 | 16.15 | 0.00 | 16.15 | 19.38 | 0.00 | 0.00 | 20.00 |
| 1069 | 1 | 61.40 | 0.00 | 52.63 | 61.40 | 0.00 | 0.00 | 42.86 |
| 1071 | 1 | 16.05 | 0.00 | 10.22 | 16.05 | 0.00 | 0.00 | 36.36 |
| 1081 | 1 | 3.08 | 0.00 | 3.08 | 3.08 | 0.00 | 0.00 | 100.00 |
| 1091 | 1 | 7.21 | 0.08 | 4.48 | 7.05 | 0.00 | 0.00 | 51.72 |
| 1092 | 1 | 19.18 | 1.92 | 9.59 | 17.27 | 0.00 | 0.00 | 70.00 |
| 1093 | 1 | 7.89 | 0.00 | 4.73 | 6.31 | 0.00 | 0.00 | 20.00 |
| 1094 | 1 | 8.94 | 0.20 | 5.69 | 8.73 | 0.00 | 0.00 | 36.36 |
| 1095 | 1 | 10.72 | 4.29 | 6.43 | 10.72 | 0.00 | 0.00 | 0.00 |
| 1096 | 1 | 40.90 | 0.00 | 33.47 | 33.47 | 0.00 | 0.00 | 63.64 |
| 1099 | 1 | 13.56 | 0.00 | 10.51 | 12.99 | 0.00 | 0.00 | 42.25 |
| 1111 | 1 | 4.93 | 0.00 | 4.11 | 4.93 | 0.00 | 0.00 | 50.00 |
| 1113 | 1 | 5.11 | 0.00 | 3.50 | 4.04 | 0.00 | 0.00 | 44.74 |
| 1121 | 1 | 12.27 | 0.00 | 11.15 | 11.15 | 0.00 | 0.00 | 63.64 |
| 1122 | 1 | 11.92 | 0.00 | 8.85 | 9.59 | 12.29 | 10.31 | 36.08 |
| 1220 | 1 | 15.73 | 0.00 | 11.80 | 15.73 | 0.00 | 0.00 | 50.00 |
| 1311 | 1 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| 1322 | 0 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| 1323 | 1 | 8.58 | 0.00 | 6.44 | 8.58 | 0.00 | 0.00 | 50.00 |
| 1330 | 1 | 49.47 | 20.47 | 22.17 | 29.00 | 0.00 | 0.00 | 17.24 |
| 1340 | 1 | 5.94 | 2.38 | 2.38 | 2.38 | 0.00 | 0.00 | 40.00 |
| 1351 | 1 | 7.28 | 0.00 | 5.82 | 7.28 | 0.00 | 0.00 | 80.00 |
| 1353 | 1 | 65.57 | 0.00 | 52.46 | 59.02 | 0.00 | 0.00 | 70.00 |
| 1354 | 1 | 15.08 | 0.00 | 9.05 | 12.06 | 0.00 | 0.00 | 60.00 |
| 1359 | 1 | 15.02 | 0.56 | 11.13 | 14.47 | 0.00 | 0.00 | 48.15 |
| 1411 | 1 | 13.27 | 0.00 | 9.61 | 13.21 | 0.00 | 0.00 | 70.69 |
| 1412 | 1 | 4.38 | 0.13 | 2.56 | 4.25 | 0.00 | 0.00 | 45.71 |
| 1413 | 1 | 5.82 | 0.00 | 2.18 | 5.82 | 0.00 | 0.00 | 12.50 |
| 1414 | 1 | 2.21 | 0.00 | 2.21 | 2.21 | 0.00 | 0.00 | 66.67 |
| 1422 | 1 | 26.66 | 0.00 | 19.04 | 26.66 | 0.00 | 0.00 | 85.71 |
| 1521 | 1 | 4.87 | 0.00 | 2.43 | 4.26 | 0.00 | 0.00 | 12.50 |
| 1529 | 1 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| 1531 | 1 | 8.13 | 0.00 | 4.06 | 8.13 | 0.00 | 0.00 | 0.00 |
| 1540 | 1 | 39.34 | 0.00 | 35.77 | 32.19 | 0.00 | 0.00 | 63.64 |
| 1610 | 1 | 17.88 | 0.00 | 8.94 | 17.88 | 447.09 | 250.00 | 50.00 |
| 1622 | 1 | 8.21 | 0.00 | 5.13 | 8.21 | 0.00 | 0.00 | 87.50 |
| 1623 | 1 | 2.88 | 0.00 | 2.88 | 2.88 | 0.00 | 0.00 | 100.00 |
| 1629 | 1 | 6.72 | 0.00 | 6.72 | 6.72 | 0.00 | 0.00 | 75.00 |
options(scipen = 999)
library(readxl)
Dicionario_AcidentesCNAE <- read_excel("D:/MESTRADO UFF 2020/Academico 2020/CIVIL/Estatistica/Artigo Steven/Dicionario-AcidentesCNAE.xlsx")
library(DT)
DT::datatable(Dicionario_AcidentesCNAE, rownames = FALSE, colnames = FALSE)
AcidentesCNAE$`Artesanal-Industrial`<-ifelse(AcidentesCNAE$`Artesanal-Industrial`==1,"Artesanal","Industrial")
summary(AcidentesCNAE)
```r
class(AcidentesCNAE$CNAE)
## [1] "character"
class(AcidentesCNAE$`Artesanal-Industrial`)
## [1] "character"
class(AcidentesCNAE$`Acidentes-16-34-anos`)
## [1] "numeric"
# 6. Execução dos Boxlots
## 6.1 Boxplot Doença Ocupacional x Atividade Artesanal-Industrial
```r
boxplot(Doenca_Ocupacional ~ `Artesanal-Industrial`,data=AcidentesCNAE,col=c("red","#faa005","#1bc704","#0f8efc","yellow"), main="Tipo de atividade x Doenca Ocupacional")
boxplot(Mortalidade ~ `Artesanal-Industrial`,data=AcidentesCNAE,col=c("red","#faa005","#1bc704","#0f8efc","yellow"), main="Tipo de atividade X - Mortalidade")
hist(AcidentesCNAE$Doenca_Ocupacional, col = "red", main = "Grafico III - HISTOGRAMA DOENÇA OCUPACIONAL", xlab = "DOENÇA OCUPACIONAL", ylab = "Frequencia")
hist(AcidentesCNAE$Mortalidade, col = "#1E90FF", main = "Grafico IV - HISTOGRAMA MORTALIDADE", xlab = "MORTALIDADE", ylab = "Frequencia")
library(corrplot)
## corrplot 0.84 loaded
plot(AcidentesCNAE$Mortalidade, AcidentesCNAE$Doenca_Ocupacional, pch=19, col = "#452a73",
xlab = "Receita bruta",
ylab = "Patrimônio líquido",
main = "Diagrama I - Diagrama de dispersão ano de 2013")
abline(lsfit(AcidentesCNAE$Mortalidade, AcidentesCNAE$Doenca_Ocupacional),col="red")
cor(AcidentesCNAE$Mortalidade, AcidentesCNAE$Doenca_Ocupacional)
## [1] -0.03188927
variaveis_quanti<-c("Mortalidade","Doenca_Ocupacional","Letalidade")
AcidentesCNAE[,variaveis_quanti]
## # A tibble: 76 x 3
## Mortalidade Doenca_Ocupacional Letalidade
## <dbl> <dbl> <dbl>
## 1 0 0 0
## 2 0 0 0
## 3 0 0 0
## 4 0 0 0
## 5 0 0 0
## 6 0 0 0
## 7 0 0 0
## 8 0 0 0
## 9 0 0.13 0
## 10 0 0 0
## # ... with 66 more rows
cor(AcidentesCNAE[,variaveis_quanti])
## Mortalidade Doenca_Ocupacional Letalidade
## Mortalidade 1.00000000 -0.03188927 0.4130364
## Doenca_Ocupacional -0.03188927 1.00000000 -0.0289286
## Letalidade 0.41303641 -0.02892860 1.0000000
correlacao_CNAE<-cor(AcidentesCNAE[,variaveis_quanti])
correlacao_CNAE
## Mortalidade Doenca_Ocupacional Letalidade
## Mortalidade 1.00000000 -0.03188927 0.4130364
## Doenca_Ocupacional -0.03188927 1.00000000 -0.0289286
## Letalidade 0.41303641 -0.02892860 1.0000000
par(mfrow=c(1,1))
corrplot(correlacao_CNAE,method = "number")
MC <-cor(AcidentesCNAE[,c("Mortalidade","Doenca_Ocupacional","Letalidade")])
corrplot.mixed(MC)
par(mfrow=c(1,1))
corrplot(correlacao_CNAE,method = "number")
MC <-cor(AcidentesCNAE[,c("Mortalidade","Doenca_Ocupacional","Acidentes-16-34-anos")])
corrplot.mixed(MC)
Se p-value ≤ alpha, rejeita H0. Se p-value > alpha, não rejeita H0.
H0:os dados seguem uma distribuição normal. H1:os dados não seguem uma distribuição normal.
shapiro.test(AcidentesCNAE$Doenca_Ocupacional)
##
## Shapiro-Wilk normality test
##
## data: AcidentesCNAE$Doenca_Ocupacional
## W = 0.17181, p-value < 0.00000000000000022
modelo <- aov(Doenca_Ocupacional~Letalidade, data=AcidentesCNAE)
residuos <- residuals(modelo)
residuos
## 1 2 3 4 5 6 7
## -0.4431269 -0.4431269 -0.4431269 -0.4431269 -0.4431269 -0.4431269 -0.4431269
## 8 9 10 11 12 13 14
## -0.4431269 -0.3131269 -0.4431269 -0.4431269 -0.4431269 -0.4431269 -0.4431269
## 15 16 17 18 19 20 21
## -0.4431269 -0.4431269 -0.4431269 0.1388809 -0.4431269 -0.3031269 -0.4431269
## 22 23 24 25 26 27 28
## 0.2168731 -0.4431269 -0.4431269 0.4046080 -0.4431269 -0.1831269 0.3168731
## 29 30 31 32 33 34 35
## -0.4431269 -0.4431269 -0.4431269 -0.3267254 -0.4431269 -0.4431269 -0.4431269
## 36 37 38 39 40 41 42
## -0.4431269 -0.4431269 -0.4431269 -0.4431269 -0.4431269 -0.4431269 -0.4431269
## 43 44 45 46 47 48 49
## -0.3631269 1.4768731 -0.4431269 -0.2431269 3.8468731 -0.4431269 -0.4431269
## 50 51 52 53 54 55 56
## -0.4431269 -0.4431269 -0.4431269 -0.4371264 -0.4431269 -0.4431269 -0.4431269
## 57 58 59 60 61 62 63
## -0.4431269 20.0268731 1.9368731 -0.4431269 -0.4431269 -0.4431269 0.1168731
## 64 65 66 67 68 69 70
## -0.4431269 -0.3131269 -0.4431269 -0.4431269 -0.4431269 -0.4431269 -0.4431269
## 71 72 73 74 75 76
## -0.4431269 -0.4431269 -0.2976250 -0.4431269 -0.4431269 -0.4431269
shapiro.test(residuos)
##
## Shapiro-Wilk normality test
##
## data: residuos
## W = 0.17603, p-value < 0.00000000000000022
qqnorm(residuos, col = "#2719c2", xlab = "Doenca_Ocupacional",
ylab = "Letalidade", main = "Gráfico-Doenca_Ocupacional x Letalidade")
qqline(residuos, col=2)
H0: os grupos são amostrados de populações com distribuições idênticas. H1: os grupos são amostrados de populações com diferentes distribuições.
kruskal.test(AcidentesCNAE$Doenca_Ocupacional~AcidentesCNAE$Letalidade)
##
## Kruskal-Wallis rank sum test
##
## data: AcidentesCNAE$Doenca_Ocupacional by AcidentesCNAE$Letalidade
## Kruskal-Wallis chi-squared = 5.9155, df = 5, p-value = 0.3145
PMW1 <- pairwise.wilcox.test(AcidentesCNAE$Doenca_Ocupacional, AcidentesCNAE$Letalidade, p.adjust.method="fdr") # Adjusts p-values for multiple comparisons;
## Warning in wilcox.test.default(xi, xj, paired = paired, ...): cannot compute
## exact p-value with ties
## Warning in wilcox.test.default(xi, xj, paired = paired, ...): cannot compute
## exact p-value with ties
## Warning in wilcox.test.default(xi, xj, paired = paired, ...): cannot compute
## exact p-value with ties
## Warning in wilcox.test.default(xi, xj, paired = paired, ...): cannot compute
## exact p-value with ties
## Warning in wilcox.test.default(xi, xj, paired = paired, ...): cannot compute
## exact p-value with ties
## Warning in wilcox.test.default(xi, xj, paired = paired, ...): cannot compute
## exact p-value with ties
PMW1
##
## Pairwise comparisons using Wilcoxon rank sum test with continuity correction
##
## data: AcidentesCNAE$Doenca_Ocupacional and AcidentesCNAE$Letalidade
##
## 0 10.31 13.29 200 250
## 10.31 1.00 - - - -
## 13.29 0.28 1.00 - - -
## 200 1.00 - 1.00 - -
## 250 1.00 - 1.00 - -
## 1000 1.00 - 1.00 - -
##
## P value adjustment method: fdr
cor.test(AcidentesCNAE$Doenca_Ocupacional, AcidentesCNAE$Letalidade,method = "spearman")
## Warning in cor.test.default(AcidentesCNAE$Doenca_Ocupacional,
## AcidentesCNAE$Letalidade, : Cannot compute exact p-value with ties
##
## Spearman's rank correlation rho
##
## data: AcidentesCNAE$Doenca_Ocupacional and AcidentesCNAE$Letalidade
## S = 71990, p-value = 0.8919
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## 0.01585558