Carregando a Base de Dados
load("C:/Users/sgonc/Desktop/Base_de_dados-master/df_pokemon.RData")
names(df)
## [1] "id" "pokemon" "species_id" "height"
## [5] "weight" "base_experience" "type_1" "type_2"
## [9] "attack" "defense" "hp" "special_attack"
## [13] "special_defense" "speed" "color_1" "color_2"
## [17] "color_f" "egg_group_1" "egg_group_2" "url_image"
## [21] "x" "y"
Diagrama de dispersão : Velocidade x Ataque
plot(df$speed, df$attack, pch=20, col="blue", main = "Diagrama de dispersão",
xlab = "Velocidade", ylab = "Poder de ataque")
abline(lsfit(df$speed, df$attack), col="darkblue")

Carregar as bibliotecas
library(corrplot)
## Warning: package 'corrplot' was built under R version 4.0.5
## corrplot 0.84 loaded
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
Matriz de correlação entre Velocidade e Ataque
cor(df$speed, df$attack)
## [1] 0.3356615
poke_quanti <- df %>% select(speed, attack, height, weight, defense, hp, special_attack, special_defense)
poke_quanti
## # A tibble: 718 x 8
## speed attack height weight defense hp special_attack special_defense
## <int> <int> <int> <int> <int> <int> <int> <int>
## 1 45 49 7 69 49 45 65 65
## 2 60 62 10 130 63 60 80 80
## 3 80 82 20 1000 83 80 100 100
## 4 65 52 6 85 43 39 60 50
## 5 80 64 11 190 58 58 80 65
## 6 100 84 17 905 78 78 109 85
## 7 43 48 5 90 65 44 50 64
## 8 58 63 10 225 80 59 65 80
## 9 78 83 16 855 100 79 85 105
## 10 45 30 3 29 35 45 20 20
## # ... with 708 more rows
MCorrel <- cor(poke_quanti)
MCorrel
## speed attack height weight defense hp
## speed 1.00000000 0.3356615 0.2249439 0.1081207 -0.00597676 0.1694177
## attack 0.33566149 1.0000000 0.4088367 0.4605428 0.43177454 0.4298658
## height 0.22494390 0.4088367 1.0000000 0.6465813 0.35995909 0.4401011
## weight 0.10812069 0.4605428 0.6465813 1.0000000 0.48171259 0.4314012
## defense -0.00597676 0.4317745 0.3599591 0.4817126 1.00000000 0.2352107
## hp 0.16941766 0.4298658 0.4401011 0.4314012 0.23521065 1.0000000
## special_attack 0.44706699 0.3278213 0.3330252 0.2793074 0.19828306 0.3678422
## special_defense 0.23825607 0.2008107 0.3239820 0.3403940 0.48187370 0.3838715
## special_attack special_defense
## speed 0.4470670 0.2382561
## attack 0.3278213 0.2008107
## height 0.3330252 0.3239820
## weight 0.2793074 0.3403940
## defense 0.1982831 0.4818737
## hp 0.3678422 0.3838715
## special_attack 1.0000000 0.4867300
## special_defense 0.4867300 1.0000000
corrplot(MCorrel, addCoef.col = TRUE, number.cex = 0.7)
