library(ggplot2)
library(readr)
library(dplyr)
library(DT)
library(visualize)
library(mosaic)
library(PerformanceAnalytics) # Para coorelaciones gráficas
source("https://raw.githubusercontent.com/rpizarrog/probabilidad-y-estad-stica/master/2023/funciones/funciones%20para%20dispersion%20correlacion%20regresion.R", encoding = "UTF-8")
Datos
juegos = c(138,1050,1327,650,900,2500,3100,2800,4700,3200)
lugar = c(700,502,120,1500,800,101,50,68,2,31)
datos = data.frame(juegos,lugar)
datos
## juegos lugar
## 1 138 700
## 2 1050 502
## 3 1327 120
## 4 650 1500
## 5 900 800
## 6 2500 101
## 7 3100 50
## 8 2800 68
## 9 4700 2
## 10 3200 31
Diagrama de dispersion
f_diag.dispersion(datos)

Covarianza
covarianza <- cov(x = datos$juegos, y = datos$lugar, )
r <- cor(x = datos$juegos, y = datos$lugar)
covarianza
## [1] -522773.4
Correlacion
prod.dispersion = sd(datos$juegos) * sd(datos$lugar)
prod.dispersion
## [1] 706265.6
r <- covarianza / prod.dispersion
r
## [1] -0.7401938
Chat correlation
chart.Correlation(datos[], histogram = TRUE)
## Warning in par(usr): argument 1 does not name a graphical parameter
