Nesta fase iremos carregar o banco de dados para ser realizada as análises.
load("C:/Users/Cristiane/Desktop/Estatistica aplicada a engenharia I/Base_de_dados-master/Titanic.RData")
summary(Titanic$Sobreviveu)
## Não sobreviveu Sobreviveu
## 1490 710
tabela1<-table(Titanic$Classe,Titanic$Sobreviveu)
tabela2<-table(Titanic$Sexo,Titanic$Sobreviveu)
tabela3<-table(Titanic$Sobreviveu)
tabela4<-table(Titanic$Idade,Titanic$Sobreviveu)
tabela5<-table(Titanic$Sobreviveu,Titanic$Sexo)
library(ggplot2)
library(forcats)
library(ggpubr)
table(Titanic$Classe,Titanic$Sobreviveu)
##
## Não sobreviveu Sobreviveu
## Tripulação 673 212
## Primeira 122 202
## Segunda 167 118
## Terceira 528 178
tabela_sobreviveu<-table(Titanic$Sobreviveu)
tabela_sobreviveu
##
## Não sobreviveu Sobreviveu
## 1490 710
round(prop.table(tabela_sobreviveu)*100,2)
##
## Não sobreviveu Sobreviveu
## 67.73 32.27
table(Titanic$Sexo,Titanic$Sobreviveu)
##
## Não sobreviveu Sobreviveu
## Feminino 126 344
## Masculino 1364 366
table(Titanic$Idade,Titanic$Sobreviveu)
##
## Não sobreviveu Sobreviveu
## criança 52 57
## adulto 1438 653
table(Titanic$Classe,Titanic$Sobreviveu)
##
## Não sobreviveu Sobreviveu
## Tripulação 673 212
## Primeira 122 202
## Segunda 167 118
## Terceira 528 178
prop.table(tabela2,1)*100
##
## Não sobreviveu Sobreviveu
## Feminino 26.80851 73.19149
## Masculino 78.84393 21.15607
round(prop.table(tabela2,1)*100,2)
##
## Não sobreviveu Sobreviveu
## Feminino 26.81 73.19
## Masculino 78.84 21.16
prop.table(tabela4)*100
##
## Não sobreviveu Sobreviveu
## criança 2.363636 2.590909
## adulto 65.363636 29.681818
round(prop.table(tabela4,1)*100,2)
##
## Não sobreviveu Sobreviveu
## criança 47.71 52.29
## adulto 68.77 31.23
prop.table(tabela1)*100
##
## Não sobreviveu Sobreviveu
## Tripulação 30.590909 9.636364
## Primeira 5.545455 9.181818
## Segunda 7.590909 5.363636
## Terceira 24.000000 8.090909
round(prop.table(tabela1,1)*100,2)
##
## Não sobreviveu Sobreviveu
## Tripulação 76.05 23.95
## Primeira 37.65 62.35
## Segunda 58.60 41.40
## Terceira 74.79 25.21
barplot(tabela3,
beside=TRUE,
col=c("#3ce6d5","#e63c3c"),
main = "GRÁFICO I - SOBREVIVENTES",
ylim = c(0,2200),ylab="Qtde de Pessoas",legend.text = TRUE)
barplot(tabela5,
beside=TRUE,
col=c("#1fd9ed","#ed1fed"),
main = "GRÁFICO II - SOBREVIVENTES POR SEXO",
ylim = c(0,2200),ylab="Qtde de Pessoas",xlab="Sexo",legend.text = TRUE)
tabela<-table(Titanic$Classe,Titanic$Sobreviveu)
tabela<-data.frame(tabela1)
ggballoonplot(tabela, fill = "value")+
ggtitle(" GRÁFICO III - SOBREVIVENTES DI TITANIC")
mosaicplot(table(Titanic$Classe,Titanic$Sobreviveu),main = " GRÁFICO IV - SOBREVIVENTES DO TITANIC",color = c("#6e665d","#c2acf2"))
barplot(tabela4,
beside=TRUE,
col=c("yellow","red"),
main = "GRÁFICO V - SOBREVIVENTES POR IDADE",
ylim = c(0,2000),ylab="Qtde de Pessoas",xlab = "IDADE",legend.text = TRUE)
barplot(tabela1,
beside=TRUE,
col=c("#acf2f0","#ecf2ac","Blue","red"),
main = "GRÁFICO VI - SOBREVIVENTES POR CLASSE",
ylim = c(0,1500),ylab="Qtde de Pessoas",xlab = "Classe",legend.text = TRUE)