Analisis de produccion de miel en el estado de Sonora, Mexico

Para el ejercicio presente usaremos datos de la cantidad de miel que se produce por año en el estado de Sonora, segun datos oficiales de la FAP STAT, obtenidos del atlas de abejas

https://atlasnacionaldelasabejasmx.github.io/atlas/cap5.html

Importar datos

setwd("~/Esta")
library(readr)
sonora <- read_csv("sonora.csv")
## 
## -- Column specification --------------------------------------------------------
## cols(
##   YEAR = col_double(),
##   PROMIEL = col_double()
## )

Vista previa a los datos

head(sonora)
## # A tibble: 6 x 2
##    YEAR PROMIEL
##   <dbl>   <dbl>
## 1  2003     542
## 2  2004     452
## 3  2005     743
## 4  2006     378
## 5  2007     369
## 6  2008     387

Medidas de tendencia central

Media

mean(sonora$PROMIEL)
## [1] 467.1891

Mediana

median(sonora$PROMIEL)
## [1] 452
sort(sonora$PROMIEL)
##  [1] 250.000 340.000 369.000 377.000 378.000 387.000 410.000 432.000 452.000
## [10] 516.000 526.000 528.214 540.000 542.000 569.000 583.000 743.000

Moda

library(modeest)
mlv(sonora$PROMIEL, method = "mfv")
##  [1] 250.000 340.000 369.000 377.000 378.000 387.000 410.000 432.000 452.000
## [10] 516.000 526.000 528.214 540.000 542.000 569.000 583.000 743.000

Rango o amplitud

maximo <- max(sonora$PROMIEL)
maximo
## [1] 743
minimo <- min(sonora$PROMIEL)
minimo
## [1] 250
rango <- (maximo - minimo)
rango
## [1] 493

Cuartiles y resumen de tendencia central

summary(sonora$PROMIEL)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   250.0   378.0   452.0   467.2   540.0   743.0

Grafico de caja y bigote

boxplot(sonora$PROMIEL)

Rango intercuartil

RIC = IQR(sonora$PROMIEL)
RIC
## [1] 162
Q3 <- 540
limitesuperior <- (Q3+1.5*RIC)
limitesuperior
## [1] 783
Q1 <- 378
limiteinferior <- (Q1-1.5*RIC)
limiteinferior
## [1] 135

Analisis de frecuencia (Absolutas, Relativas y Acumuladas)

library(fdth)
## 
## Attaching package: 'fdth'
## The following object is masked from 'package:modeest':
## 
##     mfv
## The following objects are masked from 'package:stats':
## 
##     sd, var
dist <- fdt(sonora, breaks="Sturges")
dist
## YEAR 
##       Class limits f   rf rf(%) cf  cf(%)
##  [1982.97,1992.34) 0 0.00  0.00  0   0.00
##  [1992.34,2001.71) 0 0.00  0.00  0   0.00
##  [2001.71,2011.08) 9 0.53 52.94  9  52.94
##  [2011.08,2020.45) 8 0.47 47.06 17 100.00
##  [2020.45,2029.82) 0 0.00  0.00 17 100.00
##  [2029.82,2039.19) 0 0.00  0.00 17 100.00
## 
## PROMIEL 
##       Class limits f   rf rf(%) cf  cf(%)
##    [247.5,331.322) 1 0.06  5.88  1   5.88
##  [331.322,415.143) 6 0.35 35.29  7  41.18
##  [415.143,498.965) 2 0.12 11.76  9  52.94
##  [498.965,582.787) 6 0.35 35.29 15  88.24
##  [582.787,666.608) 1 0.06  5.88 16  94.12
##   [666.608,750.43) 1 0.06  5.88 17 100.00

Poligonos e histogramas

#Absoulutos
plot(dist, type = "fh")

plot(dist, type = "fp")

#Acumulados
plot(dist, type = "cfh")

plot(dist, type = "cfp")

# Relativos
plot(dist, type = "rfh")

plot(dist, type = "rfp")