#file.choose()
bd4 <- read.csv("/Users/mayracampoyramos/Desktop/Analisis de Datos Concentracion/EMI_CARTON.csv")
library(janitor)
##
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
produccion <- clean_names(bd4)
summary(produccion)
## fecha cliente id_form producto
## Length:3988 Length:3988 Length:3988 Length:3988
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## piezas_prog tmo_min hr_fin estacion_arranque
## Length:3988 Length:3988 Length:3988 Length:3988
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## laminas_procesadas inicio_sep_up fin_inicio_de_sep_up inicio_de_proceso
## Min. : 0 Length:3988 Length:3988 Length:3988
## 1st Qu.: 0 Class :character Class :character Class :character
## Median : 51 Mode :character Mode :character Mode :character
## Mean : 102
## 3rd Qu.: 184
## Max. :1263
##
## fin_de_proceso tiempo_calidad tiempo_materiales
## Length:3988 Length:3988 Min. : 0.000
## Class :character Class :character 1st Qu.: 0.000
## Mode :character Mode :character Median : 0.000
## Mean : 3.187
## 3rd Qu.: 1.000
## Max. :60.000
## NA's :3491
produccion <- subset(produccion,select = -c (id_form, producto, hr_fin, inicio_sep_up, fin_inicio_de_sep_up, inicio_de_proceso, fin_de_proceso, tiempo_materiales))
summary(produccion)
## fecha cliente piezas_prog tmo_min
## Length:3988 Length:3988 Length:3988 Length:3988
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## estacion_arranque laminas_procesadas tiempo_calidad
## Length:3988 Min. : 0 Length:3988
## Class :character 1st Qu.: 0 Class :character
## Mode :character Median : 51 Mode :character
## Mean : 102
## 3rd Qu.: 184
## Max. :1263
library(data.table)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:data.table':
##
## between, first, last
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(plyr)
## ------------------------------------------------------------------------------
## You have loaded plyr after dplyr - this is likely to cause problems.
## If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
## library(plyr); library(dplyr)
## ------------------------------------------------------------------------------
##
## Attaching package: 'plyr'
## The following objects are masked from 'package:dplyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
library(ggplot2)
library(naniar)
library(Hmisc)
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
##
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:plyr':
##
## is.discrete, summarize
## The following objects are masked from 'package:dplyr':
##
## src, summarize
## The following objects are masked from 'package:base':
##
## format.pval, units
library(psych)
##
## Attaching package: 'psych'
## The following object is masked from 'package:Hmisc':
##
## describe
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
library(tidyverse)
## ── Attaching packages
## ───────────────────────────────────────
## tidyverse 1.3.2 ──
## ✔ tibble 3.1.8 ✔ purrr 0.3.4
## ✔ tidyr 1.2.1 ✔ stringr 1.4.1
## ✔ readr 2.1.2 ✔ forcats 0.5.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ psych::%+%() masks ggplot2::%+%()
## ✖ psych::alpha() masks ggplot2::alpha()
## ✖ plyr::arrange() masks dplyr::arrange()
## ✖ dplyr::between() masks data.table::between()
## ✖ purrr::compact() masks plyr::compact()
## ✖ plyr::count() masks dplyr::count()
## ✖ plyr::failwith() masks dplyr::failwith()
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::first() masks data.table::first()
## ✖ plyr::id() masks dplyr::id()
## ✖ dplyr::lag() masks stats::lag()
## ✖ dplyr::last() masks data.table::last()
## ✖ plyr::mutate() masks dplyr::mutate()
## ✖ plyr::rename() masks dplyr::rename()
## ✖ Hmisc::src() masks dplyr::src()
## ✖ plyr::summarise() masks dplyr::summarise()
## ✖ Hmisc::summarize() masks plyr::summarize(), dplyr::summarize()
## ✖ purrr::transpose() masks data.table::transpose()
library(knitr)
# install.packages("pollster")
library(pollster)
##
## Attaching package: 'pollster'
##
## The following object is masked from 'package:janitor':
##
## crosstab
library(epiDisplay)
## Loading required package: foreign
## Loading required package: MASS
##
## Attaching package: 'MASS'
##
## The following object is masked from 'package:dplyr':
##
## select
##
## Loading required package: nnet
##
## Attaching package: 'epiDisplay'
##
## The following objects are masked from 'package:psych':
##
## alpha, cs, lookup
##
## The following object is masked from 'package:lattice':
##
## dotplot
##
## The following object is masked from 'package:ggplot2':
##
## alpha
library(descr)
##
## Attaching package: 'descr'
##
## The following object is masked from 'package:pollster':
##
## crosstab
##
## The following object is masked from 'package:janitor':
##
## crosstab
library(tidyr)
produccion$piezas_prog<-as.numeric(produccion$piezas_prog)
## Warning: NAs introduced by coercion
produccion$tmo_min<-as.numeric(produccion$tmo_min)
## Warning: NAs introduced by coercion
produccion$laminas_procesadas<-as.numeric(produccion$laminas_procesadas)
produccion$tiempo_calidad<-as.numeric(produccion$tiempo_calidad)
## Warning: NAs introduced by coercion
produccion$fecha <- as.Date(produccion$fecha, format = "%d/%m/%Y")
summary(produccion)
## fecha cliente piezas_prog tmo_min
## Min. :2022-07-15 Length:3988 Min. : 1.0 Min. : 0.00
## 1st Qu.:2022-08-03 Class :character 1st Qu.: 100.0 1st Qu.: 15.00
## Median :2022-08-20 Mode :character Median : 153.5 Median : 20.00
## Mean :2022-08-19 Mean : 180.3 Mean : 22.37
## 3rd Qu.:2022-09-06 3rd Qu.: 200.0 3rd Qu.: 25.00
## Max. :2022-09-21 Max. :2000.0 Max. :150.00
## NA's :180 NA's :824
## estacion_arranque laminas_procesadas tiempo_calidad
## Length:3988 Min. : 0 Min. : 0.0000
## Class :character 1st Qu.: 0 1st Qu.: 0.0000
## Mode :character Median : 51 Median : 1.0000
## Mean : 102 Mean : 0.8631
## 3rd Qu.: 184 3rd Qu.: 1.0000
## Max. :1263 Max. :22.0000
## NA's :346
produccion$piezas_prog <- str_replace(produccion$piezas_prog, "[aeiouLAM=NbBsS]", "")
produccion$piezas_prog <- as.integer(produccion$laminas_procesadas)
produccion$tmo_min[is.na(produccion$tmo_min)]<-median(produccion$tmo_min, na.rm = TRUE)
produccion$tiempo_calidad[is.na(produccion$tiempo_calidad)]<-median(produccion$tiempo_calidad, na.rm = TRUE)
summary(produccion)
## fecha cliente piezas_prog tmo_min
## Min. :2022-07-15 Length:3988 Min. : 0 Min. : 0.00
## 1st Qu.:2022-08-03 Class :character 1st Qu.: 0 1st Qu.: 15.00
## Median :2022-08-20 Mode :character Median : 51 Median : 20.00
## Mean :2022-08-19 Mean : 102 Mean : 21.88
## 3rd Qu.:2022-09-06 3rd Qu.: 184 3rd Qu.: 25.00
## Max. :2022-09-21 Max. :1263 Max. :150.00
## estacion_arranque laminas_procesadas tiempo_calidad
## Length:3988 Min. : 0 Min. : 0.000
## Class :character 1st Qu.: 0 1st Qu.: 1.000
## Mode :character Median : 51 Median : 1.000
## Mean : 102 Mean : 0.875
## 3rd Qu.: 184 3rd Qu.: 1.000
## Max. :1263 Max. :22.000
bd_Produccion_limpia <- produccion
write.csv(bd_Produccion_limpia, file="bd_produccion_limpia.csv", row.names = FALSE)
media_piezas_prog<- mean(produccion$piezas_prog)
media_piezas_prog
## [1] 102.0105
media_tmo_min<- mean(produccion$tmo_min)
media_tmo_min
## [1] 21.88064
media_laminas_procesadas <- mean(produccion$laminas_procesadas)
media_laminas_procesadas
## [1] 102.0105
media_tiempo_calidad<- mean(produccion$tiempo_calidad)
media_tiempo_calidad
## [1] 0.8749749
median_piezas_prog<- median(produccion$piezas_prog)
median_piezas_prog
## [1] 51
median_tmo_min<- median(produccion$tmo_min)
median_tmo_min
## [1] 20
median_laminas_procesadas <- median(produccion$laminas_procesadas)
media_laminas_procesadas
## [1] 102.0105
median_tiempo_calidad<- median(produccion$tiempo_calidad)
median_tiempo_calidad
## [1] 1
mode <- function(x) {
ux <- unique(x)
ux[which.max(tabulate(match(x, ux)))]
}
moda_piezas_prog <- mode(produccion$piezas_prog)
moda_piezas_prog
## [1] 0
moda_tmo_min <- mode(produccion$tmo_min)
moda_tmo_min
## [1] 20
moda_laminas_procesadas<- mode(produccion$laminas_procesadas)
moda_laminas_procesadas
## [1] 0
moda_tiempo_calidad <- mode(produccion$tiempo_calidad)
moda_tiempo_calidad
## [1] 1
varianza_piezas_prog <-var(produccion$piezas_prog)
varianza_piezas_prog
## [1] 18056.03
varianza_tmo_min <-var(produccion$tmo_min)
varianza_tmo_min
## [1] 143.2895
varianza_laminas_procesadas<-var(produccion$laminas_procesadas)
varianza_laminas_procesadas
## [1] 18056.03
varianza_tiempo_calidad <-var(produccion$tiempo_calidad)
varianza_tiempo_calidad
## [1] 0.9834017
desviacion_piezas_prog<- sqrt(varianza_piezas_prog)
desviacion_piezas_prog
## [1] 134.3727
desviacion_tmo_min <- sqrt(varianza_tmo_min)
desviacion_tmo_min
## [1] 11.97036
desviacion_laminas_procesadas <- sqrt(varianza_laminas_procesadas)
desviacion_laminas_procesadas
## [1] 134.3727
desviacion_tiempo_calidad <- sqrt(varianza_tiempo_calidad)
desviacion_tiempo_calidad
## [1] 0.9916661
Variable2 <-c("piezas_prog","tmo_min ", "laminas_procesadas", "tiempo_calidad")
Promedio2 <-c("102.01", "21.88","102.01", "0.8749")
Moda2 <-c("0", "20","0", "1")
Mediana2 <-c("51","20","102.0105", "1")
Varianza2 <-c("18056.03","143.2895","18056.03", "0.9834017")
Desviación_Estándar2 <-c ("134.3727","11.97036","134.3727", "0.9916661")
tabla2 <-data.frame(Variable2,Promedio2, Moda2, Mediana2, Varianza2, Desviación_Estándar2)
tabla2
## Variable2 Promedio2 Moda2 Mediana2 Varianza2 Desviación_Estándar2
## 1 piezas_prog 102.01 0 51 18056.03 134.3727
## 2 tmo_min 21.88 20 20 143.2895 11.97036
## 3 laminas_procesadas 102.01 0 102.0105 18056.03 134.3727
## 4 tiempo_calidad 0.8749 1 1 0.9834017 0.9916661
knitr::kable(tabla2)
| Variable2 | Promedio2 | Moda2 | Mediana2 | Varianza2 | Desviación_Estándar2 |
|---|---|---|---|---|---|
| piezas_prog | 102.01 | 0 | 51 | 18056.03 | 134.3727 |
| tmo_min | 21.88 | 20 | 20 | 143.2895 | 11.97036 |
| laminas_procesadas | 102.01 | 0 | 102.0105 | 18056.03 | 134.3727 |
| tiempo_calidad | 0.8749 | 1 | 1 | 0.9834017 | 0.9916661 |
ggplot(produccion,aes(x=fecha))+
geom_line(aes(y=piezas_prog),color="blue")+
labs(x="Fecha",y="piezas programadas", color="blue")+
ggtitle("Grafica de las piezas programadas por fecha")
ggplot(produccion, aes(x=tmo_min, y=laminas_procesadas)) +
geom_bar(stat="identity", fill="grey") + scale_fill_grey() +
labs(title = "Grafico de barras de las piezas programadas dentro del tiempo minimo",
x = "tiempo minimo", y = "laminas procesadas")
ggplot(produccion,aes(x=reorder(tmo_min, piezas_prog), y=piezas_prog,fill=cliente)) +
geom_bar(stat="identity")
ggplot(produccion, aes(x=piezas_prog, y=cliente)) +
geom_point()
# file.choose()
merma<- read.csv("/Users/mayracampoyramos/Desktop/Analisis de Datos Concentracion/Reto/FORM - Merma 1.csv")
summary(merma)
## Fecha Mes Kilos
## Length:60 Length:60 Length:60
## Class :character Class :character Class :character
## Mode :character Mode :character Mode :character
merma1<- merma[-c(5,12,19,25,31,36,42,54,59,60),]
merma1$Kilos <- as.integer(merma1$Kilos)
str(merma1)
## 'data.frame': 50 obs. of 3 variables:
## $ Fecha: chr "11/01/22" "11/01/22" "22/01/22" "22/01/22" ...
## $ Mes : chr "ENERO" "ENERO" "ENERO" "ENERO" ...
## $ Kilos: int 5080 3810 2990 2680 3650 4380 3870 3590 3410 3930 ...
merma_limpia <- merma1
write.csv(merma_limpia, file ="merma_bd_limpia.csv", row.names = FALSE)
media_kilos <- mean(merma1$Kilos)
media_kilos
## [1] 3708.52
mediana_kilos <- median(merma1$Kilos)
mediana_kilos
## [1] 3925
mode <- function (x) {
ux <- unique(x)
ux [which.max(tabulate(match(x,ux)))]
}
mode_fecha <- mode(merma1$Fecha)
mode_fecha
## [1] "18/02/22"
mode_mes <- mode(merma1$Mes)
mode_mes
## [1] "AGOSTO"
mode_kilos <- mode(merma1$Kilos)
mode_kilos
## [1] 3810
varianza_kilos <- var(merma1$Kilos)
varianza_kilos
## [1] 1048555
desviacionestandar_kilos <- sqrt(varianza_kilos)
desviacionestandar_kilos
## [1] 1023.99
Variable<-c("Fecha", "Mes", "Kilos")
Media<-c("NA", "NA", media_kilos)
Mediana<-c("NA", "NA", mediana_kilos)
Moda<-c(mode_fecha, mode_mes, mode_kilos)
Desviacion_Estandar<-c("NA", "NA", desviacionestandar_kilos)
table<-data.frame(Variable,Media,Mediana,Moda,Desviacion_Estandar)
knitr::kable(table)
| Variable | Media | Mediana | Moda | Desviacion_Estandar |
|---|---|---|---|---|
| Fecha | NA | NA | 18/02/22 | NA |
| Mes | NA | NA | AGOSTO | NA |
| Kilos | 3708.52 | 3925 | 3810 | 1023.98960135026 |
# install.packages("ggplot2")
library(ggplot2)
ggplot(merma1, aes(x=Mes, y=Kilos)) +
geom_bar(stat="identity", fill="orange") + scale_fill_grey() + # Add bars to the plot
labs(title = "Relación de los kilos de merma en el mes", # Add a title
subtitle = "Merma empresa FORM", # Add a subtitle
caption = "Relación", # Add a caption
x = "Mes")
boxplot(merma1$Kilos)
# file.choose()
scrap<- read.csv("/Users/mayracampoyramos/Desktop/Analisis de Datos Concentracion/Reto/FORM - Scrap.csv")
summary(scrap)
## Referencia Fecha Producto Cantidad
## Length:251 Length:251 Length:251 Min. : 0.00
## Class :character Class :character Class :character 1st Qu.: 1.00
## Mode :character Mode :character Mode :character Median : 2.00
## Mean : 13.34
## 3rd Qu.: 7.00
## Max. :1674.00
## Unidad.de.medida Ubicación.de.origen Ubicación.de.desecho Estado
## Length:251 Length:251 Length:251 Length:251
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## Hora
## Length:251
## Class :character
## Mode :character
##
##
##
scrap1<- scrap [-1,]
scrap1 <- subset(scrap1, select = -c ( Referencia, Producto,Unidad.de.medida, Ubicación.de.desecho, Estado, Hora))
summary(scrap1)
## Fecha Cantidad Ubicación.de.origen
## Length:250 Min. : 0.000 Length:250
## Class :character 1st Qu.: 1.000 Class :character
## Mode :character Median : 2.000 Mode :character
## Mean : 6.696
## 3rd Qu.: 7.000
## Max. :96.000
scrap1$Cantidad <- as.integer(scrap1$Cantidad)
str(scrap1)
## 'data.frame': 250 obs. of 3 variables:
## $ Fecha : chr "31/08/22" "31/08/22" "31/08/22" "31/08/22" ...
## $ Cantidad : int 2 1 1 31 1 1 1 9 2 1 ...
## $ Ubicación.de.origen: chr "SAB/Calidad/Entrega de PT" "SAB/Calidad/Entrega de PT" "SAB/Calidad/Entrega de PT" "SAB/Pre-Production" ...
scrap_limpia <- scrap1
write.csv(scrap_limpia, file ="scrap_bd_limpia.csv", row.names = FALSE)
media_cantidad <- mean(scrap1$Cantidad)
media_cantidad
## [1] 6.692
mediana_cantidad <- median(scrap1$Cantidad)
mediana_cantidad
## [1] 2
mode <- function (x) {
ux <- unique(x)
ux [which.max(tabulate(match(x,ux)))]
}
mode_fecha1 <- mode(scrap1$Fecha)
mode_fecha1
## [1] "16/08/22"
mode_cantidad <- mode(scrap1$Cantidad)
mode_cantidad
## [1] 1
mode_ubicacion <- mode(scrap1$Ubicación.de.origen)
mode_ubicacion
## [1] "SAB/Pre-Production"
varianza_cantidad <- var(scrap1$Cantidad)
varianza_cantidad
## [1] 140.4309
desviacionestandar_cantidad <- sqrt(varianza_cantidad)
desviacionestandar_cantidad
## [1] 11.85035
Variable<-c("Fecha", "Cantidad", "Ubicación_de_origen")
Media<-c("NA", media_cantidad, "NA")
Mediana<-c("NA",mediana_cantidad, "NA")
Moda<-c(mode_fecha1, mode_cantidad, mode_ubicacion)
Desviacion_Estandar<-c("NA", desviacionestandar_cantidad, "NA")
table<-data.frame(Variable,Media,Mediana,Moda,Desviacion_Estandar)
knitr::kable(table)
| Variable | Media | Mediana | Moda | Desviacion_Estandar |
|---|---|---|---|---|
| Fecha | NA | NA | 16/08/22 | NA |
| Cantidad | 6.692 | 2 | 1 | 11.8503527136432 |
| Ubicación_de_origen | NA | NA | SAB/Pre-Production | NA |
# install.packages("ggplot2")
library(ggplot2)
ggplot(scrap1, aes(x=Ubicación.de.origen, y=Cantidad)) +
geom_bar(stat="identity", fill="brown") + scale_fill_grey() + # Add bars to the plot
labs(title = "Donde se encuentra la merma", # Add a title
subtitle = "RH empresa FORM", # Add a subtitle
caption = "Relación", # Add a caption
x = "Mes")
ggplot(data=scrap1, mapping = aes(Ubicación.de.origen, Cantidad)) + geom_point() + theme_bw()
# file.choose()
bd2 <- read.csv("/Users/mayracampoyramos/Downloads/FORM - Delivery Performance BD BUENA.csv")
library(dplyr)
library(janitor)
performance <- clean_names(bd2)
summary(performance)
## fecha printel mahle magna
## Length:324 Min. :0.0000 Min. :-11.650 Min. :0
## Class :character 1st Qu.:0.0000 1st Qu.: 1.800 1st Qu.:0
## Mode :character Median :0.0000 Median : 3.000 Median :0
## Mean :0.4418 Mean : 2.364 Mean :0
## 3rd Qu.:1.0000 3rd Qu.: 3.150 3rd Qu.:0
## Max. :4.4000 Max. : 20.000 Max. :0
## NA's :25 NA's :25 NA's :25
## varroc x x_1 x_2 x_3
## Min. :0 Mode:logical Mode:logical Mode:logical Mode:logical
## 1st Qu.:0 NA's:324 NA's:324 NA's:324 NA's:324
## Median :0
## Mean :0
## 3rd Qu.:0
## Max. :0
## NA's :25
performance <- subset(performance, select = -c(x, x_1, x_2, x_3))
summary(performance)
## fecha printel mahle magna
## Length:324 Min. :0.0000 Min. :-11.650 Min. :0
## Class :character 1st Qu.:0.0000 1st Qu.: 1.800 1st Qu.:0
## Mode :character Median :0.0000 Median : 3.000 Median :0
## Mean :0.4418 Mean : 2.364 Mean :0
## 3rd Qu.:1.0000 3rd Qu.: 3.150 3rd Qu.:0
## Max. :4.4000 Max. : 20.000 Max. :0
## NA's :25 NA's :25 NA's :25
## varroc
## Min. :0
## 1st Qu.:0
## Median :0
## Mean :0
## 3rd Qu.:0
## Max. :0
## NA's :25
performance$fecha <- as.Date(performance$fecha, format = "%d/%m/%Y")
tibble(performance)
## # A tibble: 324 × 5
## fecha printel mahle magna varroc
## <date> <dbl> <dbl> <dbl> <dbl>
## 1 2021-07-22 0 2.65 0 0
## 2 2021-07-25 1.8 2.85 0 0
## 3 2021-07-26 1.1 2.5 0 0
## 4 2021-07-27 0.5 2.5 0 0
## 5 2021-07-28 0.5 2.55 0 0
## 6 2021-07-29 1 2.65 0 0
## 7 2021-08-01 1 2.51 0 0
## 8 2021-08-02 1 3 0 0
## 9 2021-08-03 0 3 0 0
## 10 2021-08-04 1.2 3.05 0 0
## # … with 314 more rows
performance$printel <- substr(performance$printel, start = 1, stop = 2)
tibble(performance)
## # A tibble: 324 × 5
## fecha printel mahle magna varroc
## <date> <chr> <dbl> <dbl> <dbl>
## 1 2021-07-22 0 2.65 0 0
## 2 2021-07-25 1. 2.85 0 0
## 3 2021-07-26 1. 2.5 0 0
## 4 2021-07-27 0. 2.5 0 0
## 5 2021-07-28 0. 2.55 0 0
## 6 2021-07-29 1 2.65 0 0
## 7 2021-08-01 1 2.51 0 0
## 8 2021-08-02 1 3 0 0
## 9 2021-08-03 0 3 0 0
## 10 2021-08-04 1. 3.05 0 0
## # … with 314 more rows
performance$printel <- as.numeric(performance$printel)
str(performance)
## 'data.frame': 324 obs. of 5 variables:
## $ fecha : Date, format: "2021-07-22" "2021-07-25" ...
## $ printel: num 0 1 1 0 0 1 1 1 0 1 ...
## $ mahle : num 2.65 2.85 2.5 2.5 2.55 2.65 2.51 3 3 3.05 ...
## $ magna : num 0 0 0 0 0 0 0 0 0 0 ...
## $ varroc : num 0 0 0 0 0 0 0 0 0 0 ...
performance$mahle <- substr(performance$mahle, start = 1, stop = 2)
performance$mahle <- as.numeric(performance$mahle)
performance$magna <- substr(performance$magna, start = 1, stop = 2)
performance$magna <- as.numeric(performance$magna)
str(performance)
## 'data.frame': 324 obs. of 5 variables:
## $ fecha : Date, format: "2021-07-22" "2021-07-25" ...
## $ printel: num 0 1 1 0 0 1 1 1 0 1 ...
## $ mahle : num 2 2 2 2 2 2 2 3 3 3 ...
## $ magna : num 0 0 0 0 0 0 0 0 0 0 ...
## $ varroc : num 0 0 0 0 0 0 0 0 0 0 ...
performance$varroc <- substr(performance$varroc, start = 1, stop = 2)
performance$varroc <- as.numeric(performance$varroc)
str(performance)
## 'data.frame': 324 obs. of 5 variables:
## $ fecha : Date, format: "2021-07-22" "2021-07-25" ...
## $ printel: num 0 1 1 0 0 1 1 1 0 1 ...
## $ mahle : num 2 2 2 2 2 2 2 3 3 3 ...
## $ magna : num 0 0 0 0 0 0 0 0 0 0 ...
## $ varroc : num 0 0 0 0 0 0 0 0 0 0 ...
sapply(performance, function(x) sum(is.na(x)))
## fecha printel mahle magna varroc
## 25 25 25 25 25
performance$fecha[is.na(performance$fecha)]<-median(performance$fecha, na.rm = TRUE)
performance$printel[is.na(performance$printel)]<-median(performance$printel, na.rm = TRUE)
performance$mahle[is.na(performance$mahle)]<-median(performance$mahle, na.rm = TRUE)
performance$magna[is.na(performance$magna)]<-median(performance$magna, na.rm = TRUE)
performance$varroc[is.na(performance$varroc)]<-median(performance$varroc, na.rm = TRUE)
summary(performance)
## fecha printel mahle magna varroc
## Min. :2021-07-22 Min. :0.0000 Min. :-9.00 Min. :0 Min. :0
## 1st Qu.:2021-10-20 1st Qu.:0.0000 1st Qu.: 2.00 1st Qu.:0 1st Qu.:0
## Median :2022-02-07 Median :0.0000 Median : 3.00 Median :0 Median :0
## Mean :2022-01-30 Mean :0.3395 Mean : 2.21 Mean :0 Mean :0
## 3rd Qu.:2022-04-27 3rd Qu.:0.2500 3rd Qu.: 3.00 3rd Qu.:0 3rd Qu.:0
## Max. :2022-07-23 Max. :4.0000 Max. :20.00 Max. :0 Max. :0
write.csv(performance, file="performance_bd_limpia.csv", row.names = FALSE)
media_printel <- mean(performance$printel)
media_printel
## [1] 0.3395062
media_mahle <- mean(performance$mahle)
media_mahle
## [1] 2.209877
media_magna <- mean(performance$magna)
media_magna
## [1] 0
media_varroc <- mean(performance$varroc)
media_varroc
## [1] 0
mediana_printel <- median(performance$printel)
mediana_printel
## [1] 0
mediana_mahle <- median(performance$mahle)
mediana_mahle
## [1] 3
mediana_magna <- median(performance$magna)
mediana_magna
## [1] 0
mediana_varroc <- median(performance$varroc)
mediana_varroc
## [1] 0
mode <- function(x) {
ux <- unique(x)
ux[which.max(tabulate(match(x, ux)))]
}
moda_printel <- mode(performance$printel)
moda_printel
## [1] 0
moda_mahle <- mode(performance$mahle)
moda_mahle
## [1] 3
moda_magna <- mode(performance$magna)
moda_magna
## [1] 0
moda_varroc <- mode(performance$varroc)
moda_varroc
## [1] 0
varianza_printel <-var(performance$printel)
varianza_printel
## [1] 0.4416542
varianza_mahle <-var(performance$mahle)
varianza_mahle
## [1] 2.909376
varianza_magna <-var(performance$magna)
varianza_magna
## [1] 0
varianza_varroc <-var(performance$varroc)
varianza_varroc
## [1] 0
desviacion_printel <- sqrt(varianza_printel)
desviacion_printel
## [1] 0.6645707
desviacion_mahle <- sqrt(varianza_mahle)
desviacion_mahle
## [1] 1.705689
desviacion_magna <- sqrt(varianza_magna)
desviacion_magna
## [1] 0
desviacion_varroc <- sqrt(varianza_varroc)
desviacion_varroc
## [1] 0
Variable2 <-c("Printel","Mahle", "Magna", "Varroc")
Promedio2 <-c("0.339", "2.209","0", "0")
Moda2 <-c(" "," "," ", " ")
Mediana2 <-c("0","3","0", "0")
Varianza2 <-c("0.441","2.909","0", "0")
Desviación_Estándar2 <-c ("0.664","1.705","0", "0")
tabla2 <-data.frame(Variable2,Promedio2, Moda2, Mediana2, Varianza2, Desviación_Estándar2)
tabla2
## Variable2 Promedio2 Moda2 Mediana2 Varianza2 Desviación_Estándar2
## 1 Printel 0.339 0 0.441 0.664
## 2 Mahle 2.209 3 2.909 1.705
## 3 Magna 0 0 0 0
## 4 Varroc 0 0 0 0
knitr::kable(tabla2)
| Variable2 | Promedio2 | Moda2 | Mediana2 | Varianza2 | Desviación_Estándar2 |
|---|---|---|---|---|---|
| Printel | 0.339 | 0 | 0.441 | 0.664 | |
| Mahle | 2.209 | 3 | 2.909 | 1.705 | |
| Magna | 0 | 0 | 0 | 0 | |
| Varroc | 0 | 0 | 0 | 0 |
ggplot(performance,aes(x=fecha))+
geom_line(aes(y=printel),color="blue")+
geom_line(aes(y=mahle),color="orange")+
geom_line(aes(y=magna),color="green")+
geom_line(aes(y=varroc),color="green")+
labs(x="Fecha",y="Retraso en horas", color="Legend")+
ggtitle("Retrasos de entrega por cliente")
library(data.table)
library(dplyr)
library(plyr)
library(ggplot2)
library(naniar)
library(Hmisc)
library(psych)
library(tidyverse)
library(janitor)
library(knitr)
library(pollster)
library(epiDisplay)
library(descr)
library(tidyr)
library(ggeasy)
library(stringr)
library(patchwork)
##
## Attaching package: 'patchwork'
## The following object is masked from 'package:MASS':
##
## area
# file.choose()
bd <- read.csv("/Users/mayracampoyramos/Desktop/Analisis de Datos Concentracion/Delivery Plan FINAL - EQUIPO 4 .csv")
bd <- clean_names(bd)
bd <- bd %>% dplyr::rename(cliente=cliente_planta,
A_jun_21=junio,
B_jul_21=julio,
C_ago_21=agosto,
D_sep_21=septiembre,
E_oct_21=octubre,
F_nov_21=noviembre,
G_dic_21=diciembre,
H_ene_22=ene_22,
I_feb_22=feb_22,
J_mar_22=mar_22,
K_abr_22=abr_22,
L_may_22=may_22,
M_jun_22=jun_22,
N_jul_22=jul_22,
O_ago_22=ago_22,
P_sep_22=sep_22,
Q_oct_22=octubre_22,
R_nov_22=nov_22,
S_dic_22=dic_22,
T_ene_23=ene_23,
U_feb_23=feb_23,
V_mar_23=feb_23
)
colnames(bd)
## [1] "cliente" "proyecto" "id_odoo" "item" "A_jun_21"
## [6] "B_jul_21" "C_ago_21" "D_sep_21" "E_oct_21" "F_nov_21"
## [11] "G_dic_21" "H_ene_22" "I_feb_22" "J_mar_22" "K_abr_22"
## [16] "L_may_22" "M_jun_22" "N_jul_22" "O_ago_22" "P_sep_22"
## [21] "Q_oct_22" "R_nov_22" "S_dic_22" "T_ene_23" "V_mar_23"
## [26] "mar_23" "total_meses"
bd <- pivot_longer(bd, cols=5:14, names_to = "Mes", values_to = "Unidades")
str(bd)
## tibble [2,310 × 19] (S3: tbl_df/tbl/data.frame)
## $ cliente : chr [1:2310] "STB3" "STB3" "STB3" "STB3" ...
## $ proyecto : chr [1:2310] "CANASTILLA GRIS" "CANASTILLA GRIS" "CANASTILLA GRIS" "CANASTILLA GRIS" ...
## $ id_odoo : chr [1:2310] "15.785" "15.785" "15.785" "15.785" ...
## $ item : chr [1:2310] "CABLE SET CAJA BACK UP CANASTILLA" "CABLE SET CAJA BACK UP CANASTILLA" "CABLE SET CAJA BACK UP CANASTILLA" "CABLE SET CAJA BACK UP CANASTILLA" ...
## $ K_abr_22 : int [1:2310] 0 0 0 0 0 0 0 0 0 0 ...
## $ L_may_22 : int [1:2310] 0 0 0 0 0 0 0 0 0 0 ...
## $ M_jun_22 : int [1:2310] 200 200 200 200 200 200 200 200 200 200 ...
## $ N_jul_22 : int [1:2310] 900 900 900 900 900 900 900 900 900 900 ...
## $ O_ago_22 : int [1:2310] 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...
## $ P_sep_22 : int [1:2310] 0 0 0 0 0 0 0 0 0 0 ...
## $ Q_oct_22 : int [1:2310] 0 0 0 0 0 0 0 0 0 0 ...
## $ R_nov_22 : int [1:2310] 0 0 0 0 0 0 0 0 0 0 ...
## $ S_dic_22 : int [1:2310] 0 0 0 0 0 0 0 0 0 0 ...
## $ T_ene_23 : int [1:2310] 0 0 0 0 0 0 0 0 0 0 ...
## $ V_mar_23 : int [1:2310] 0 0 0 0 0 0 0 0 0 0 ...
## $ mar_23 : int [1:2310] 0 0 0 0 0 0 0 0 0 0 ...
## $ total_meses: int [1:2310] 3850 3850 3850 3850 3850 3850 3850 3850 3850 3850 ...
## $ Mes : chr [1:2310] "A_jun_21" "B_jul_21" "C_ago_21" "D_sep_21" ...
## $ Unidades : int [1:2310] 0 140 530 0 200 0 150 230 500 0 ...
bd1 <- filter(bd, Unidades>0)
bd2 <- bd1
bd2 <- subset (bd1, select = -c (proyecto, id_odoo, item, K_abr_22, L_may_22, M_jun_22,N_jul_22,O_ago_22, P_sep_22, Q_oct_22, R_nov_22, S_dic_22, T_ene_23, V_mar_23, mar_23, total_meses))
summary(bd2)
## cliente Mes Unidades
## Length:590 Length:590 Min. : 1.0
## Class :character Class :character 1st Qu.: 30.0
## Mode :character Mode :character Median : 80.0
## Mean : 358.4
## 3rd Qu.: 300.0
## Max. :13120.0
Delivery_Plan <- bd2
write.csv(Delivery_Plan, file = "Ddeliveryplan_bd_limpia.csv", row.names = FALSE)
Media <- mean(bd2$Unidades)
Media
## [1] 358.3729
Mediana <- median(bd2$Unidades)
Mediana
## [1] 80
mode <- function(x) {
ux <- unique(x)
ux[which.max(tabulate(match(x, ux)))]
}
Moda_clientes <- mode(bd2$cliente)
Moda_clientes
## [1] "VARROC"
Moda_mes <- mode(bd2$Mes)
Moda_mes
## [1] "H_ene_22"
Moda_unidades <- mode(bd2$Unidades)
Moda_unidades
## [1] 60
varianza_unidades_prog <- var(bd2$Unidades)
varianza_unidades_prog
## [1] 1005677
desviacion_unidades_prog<- sqrt(varianza_unidades_prog)
desviacion_unidades_prog
## [1] 1002.834
Variable<-c("Unidades", "Mes", "cliente")
Media<-c(Media, "NA", "NA")
Mediana<-c(Mediana, "NA", "NA")
Moda<-c(Moda_unidades, Moda_mes, Moda_clientes)
Desviacion_Estandar<-c("1002.834", "NA", "NA")
table1 <- data.frame(Variable, Media, Mediana, Moda, Desviacion_Estandar)
knitr::kable(table)
| Variable | Media | Mediana | Moda | Desviacion_Estandar |
|---|---|---|---|---|
| Fecha | NA | NA | 16/08/22 | NA |
| Cantidad | 6.692 | 2 | 1 | 11.8503527136432 |
| Ubicación_de_origen | NA | NA | SAB/Pre-Production | NA |
ggplot(bd2, aes(x = bd2$Mes, y = bd2$Unidades)) +
geom_point(shape=19, size=3) +
labs(title = "Relación entre Unidades y Meses",caption ="FORM Merma",x="Mes", y="Unidades") +
theme_classic()
## Warning: Use of `bd2$Mes` is discouraged. Use `Mes` instead.
## Warning: Use of `bd2$Unidades` is discouraged. Use `Unidades` instead.
ggplot(bd2, aes(Mes,Unidades)) +
geom_bar(stat = "identity") +
scale_fill_brewer(palette = "Set2") + ggtitle("Unidades vendidas por Mes")
# file.choose()
bd <- read.csv( "/Users/mayracampoyramos/Desktop/Analisis de Datos Concentracion/Reto/FORM - Recursos Humanos - colaboradores.csv")
# install.packages("dplyr")
library(dplyr)
# install.packages("janitor")
library(janitor)
colaboradores <- clean_names(bd)
summary(colaboradores)
## no_empleado nombre_completo edad genero
## Min. : 1 Length:113 Min. :18.00 Length:113
## 1st Qu.: 29 Class :character 1st Qu.:26.00 Class :character
## Median : 57 Mode :character Median :34.00 Mode :character
## Mean : 57 Mean :36.06
## 3rd Qu.: 85 3rd Qu.:45.00
## Max. :113 Max. :73.00
##
## fecha_alta antiguedad puesto mano_de_obra
## Length:113 Min. : 0.000 Length:113 Length:113
## Class :character 1st Qu.: 0.000 Class :character Class :character
## Mode :character Median : 0.000 Mode :character Mode :character
## Mean : 1.425
## 3rd Qu.: 2.000
## Max. :12.000
##
## salario_diario estado_civil
## Min. :144.4 Length:113
## 1st Qu.:176.7 Class :character
## Median :180.7 Mode :character
## Mean :179.1
## 3rd Qu.:180.7
## Max. :337.1
## NA's :2
colaboradores <- subset(colaboradores, select = -c(no_empleado, nombre_completo, fecha_alta, mano_de_obra))
colaboradores$salario_diario[is.na(colaboradores$salario_diario)]<-mean(colaboradores$salario_diario, na.rm = TRUE)
summary (colaboradores)
## edad genero antiguedad puesto
## Min. :18.00 Length:113 Min. : 0.000 Length:113
## 1st Qu.:26.00 Class :character 1st Qu.: 0.000 Class :character
## Median :34.00 Mode :character Median : 0.000 Mode :character
## Mean :36.06 Mean : 1.425
## 3rd Qu.:45.00 3rd Qu.: 2.000
## Max. :73.00 Max. :12.000
## salario_diario estado_civil
## Min. :144.4 Length:113
## 1st Qu.:176.7 Class :character
## Median :180.7 Mode :character
## Mean :179.1
## 3rd Qu.:180.7
## Max. :337.1
write.csv(colaboradores, file="colaboradores_bd_limpia.csv", row.names = FALSE)
media_edad <- mean(colaboradores$edad)
media_edad
## [1] 36.06195
media_antiguedad <- mean(colaboradores$antiguedad)
media_antiguedad
## [1] 1.424779
media_salario <- mean(colaboradores$salario_diario)
media_salario
## [1] 179.0981
mediana_edad <- median(colaboradores$edad)
mediana_edad
## [1] 34
mediana_antiguedad <- median(colaboradores$antiguedad)
mediana_antiguedad
## [1] 0
mediana_salario <- median(colaboradores$salario_diario)
mediana_salario
## [1] 180.68
mode <- function(x) {
ux <- unique(x)
ux[which.max(tabulate(match(x, ux)))]
}
moda_edad <- mode(colaboradores$edad)
moda_edad
## [1] 32
moda_antiguedad <- mode(colaboradores$antiguedad)
moda_antiguedad
## [1] 0
moda_salario <- mode(colaboradores$salario_diario)
moda_salario
## [1] 180.68
varianza_edad <-var(colaboradores$edad)
varianza_edad
## [1] 165.0051
varianza_antiguedad <-var(colaboradores$antiguedad)
varianza_antiguedad
## [1] 6.353666
varianza_salario <-var(colaboradores$salario_diario)
varianza_salario
## [1] 589.7227
desviacion_edad <- sqrt(varianza_edad)
desviacion_edad
## [1] 12.84543
desviacion_antiguedad <- sqrt(varianza_antiguedad)
desviacion_antiguedad
## [1] 2.520648
desviacion_salario <- sqrt(varianza_salario)
desviacion_salario
## [1] 24.28421
Variable <-c("Edad","Antiguedad","Salario Diario")
Promedio <-c("36", "1.42","179.098")
Moda <-c("32","0","180.68")
Mediana <-c("34","0","180.68")
Varianza <-c("165.005","6.353","589.722")
Desviación_Estándar <-c ("12.845","2.520","24.284")
tabla <-data.frame(Variable,Promedio, Moda, Mediana, Varianza, Desviación_Estándar)
tabla
## Variable Promedio Moda Mediana Varianza Desviación_Estándar
## 1 Edad 36 32 34 165.005 12.845
## 2 Antiguedad 1.42 0 0 6.353 2.520
## 3 Salario Diario 179.098 180.68 180.68 589.722 24.284
knitr::kable(tabla)
| Variable | Promedio | Moda | Mediana | Varianza | Desviación_Estándar |
|---|---|---|---|---|---|
| Edad | 36 | 32 | 34 | 165.005 | 12.845 |
| Antiguedad | 1.42 | 0 | 0 | 6.353 | 2.520 |
| Salario Diario | 179.098 | 180.68 | 180.68 | 589.722 | 24.284 |
hist(colaboradores$edad, freq=TRUE, col="purple", main="Edad en años de los Colaboradores actuales")
ggplot(colaboradores, aes(x=genero, y=salario_diario, fill=genero)) +
geom_bar(stat="identity") +
facet_grid(~estado_civil) + scale_fill_brewer(palette = "Set2")
ggplot(data=colaboradores, mapping = aes(edad, salario_diario)) + geom_point(aes(color = genero)) + theme_bw()
# file.choose()
bd1 <- read.csv("/Users/mayracampoyramos/Desktop/Analisis de Datos Concentracion/Reto/FORM - Recursos Humanos - bajas.csv")
bajas <- clean_names(bd1)
summary(bajas)
## no_empleado nombre_completo edad genero
## Min. : 1.00 Length:238 Min. :19.00 Length:238
## 1st Qu.: 60.25 Class :character 1st Qu.:23.00 Class :character
## Median :119.50 Mode :character Median :29.00 Mode :character
## Mean :119.50 Mean :31.06
## 3rd Qu.:178.75 3rd Qu.:37.00
## Max. :238.00 Max. :61.00
## fecha_alta antiguedad motivo_baja baja
## Length:238 Min. :0.000 Length:238 Length:238
## Class :character 1st Qu.:0.000 Class :character Class :character
## Mode :character Median :0.000 Mode :character Mode :character
## Mean :0.605
## 3rd Qu.:1.000
## Max. :6.000
## puesto salario_diario
## Length:238 Min. :144.4
## Class :character 1st Qu.:180.7
## Mode :character Median :180.7
## Mean :178.0
## 3rd Qu.:180.7
## Max. :500.0
bajas <- subset(bajas, select = -c(no_empleado, nombre_completo, fecha_alta))
bajas$antiguedad[is.na(bajas$antiguedad)]<-0
bajas$edad[is.na(bajas$edad)]<-mean(bajas$edad, na.rm = TRUE)
bajas$salario_diario[is.na(bajas$salario_diario)]<-mean(bajas$salario_diario, na.rm = TRUE)
summary (bajas)
## edad genero antiguedad motivo_baja
## Min. :19.00 Length:238 Min. :0.000 Length:238
## 1st Qu.:23.00 Class :character 1st Qu.:0.000 Class :character
## Median :29.00 Mode :character Median :0.000 Mode :character
## Mean :31.06 Mean :0.605
## 3rd Qu.:37.00 3rd Qu.:1.000
## Max. :61.00 Max. :6.000
## baja puesto salario_diario
## Length:238 Length:238 Min. :144.4
## Class :character Class :character 1st Qu.:180.7
## Mode :character Mode :character Median :180.7
## Mean :178.0
## 3rd Qu.:180.7
## Max. :500.0
bajas$baja <- as.Date(bajas$baja, format = "%d/%m/%Y")
tibble(bajas)
## # A tibble: 238 × 7
## edad genero antiguedad motivo_baja baja puesto salar…¹
## <dbl> <chr> <dbl> <chr> <date> <chr> <dbl>
## 1 32 MASCULINO 3 RENUNCIA VOLUNTARIA 2021-11-27 DISEÑO 500
## 2 36 FEMENINO 1 RENUNCIA VOLUNTARIA 2022-01-08 AYUDANTE G… 152.
## 3 24 FEMENINO 1 RENUNCIA VOLUNTARIA 2022-01-08 AYUDANTE G… 152.
## 4 21 FEMENINO 1 RENUNCIA VOLUNTARIA 2022-01-08 AYUDANTE G… 152.
## 5 30 FEMENINO 1 RENUNCIA VOLUNTARIA 2022-01-08 AYUDANTE G… 152.
## 6 46 FEMENINO 1 BAJA POR FALTAS 2022-01-08 AYUDANTE G… 152.
## 7 29 FEMENINO 1 BAJA POR FALTAS 2022-01-08 AYUDANTE G… 152.
## 8 31 MASCULINO 1 BAJA POR FALTAS 2022-01-08 AYUDANTE G… 152.
## 9 50 MASCULINO 1 BAJA POR FALTAS 2022-01-08 AYUDANTE G… 152.
## 10 19 MASCULINO 1 RENUNCIA VOLUNTARIA 2022-01-10 AYUDANTE G… 177.
## # … with 228 more rows, and abbreviated variable name ¹salario_diario
bajas$baja[is.na(bajas$baja)]<-mean(bajas$baja, na.rm = TRUE)
summary (bajas)
## edad genero antiguedad motivo_baja
## Min. :19.00 Length:238 Min. :0.000 Length:238
## 1st Qu.:23.00 Class :character 1st Qu.:0.000 Class :character
## Median :29.00 Mode :character Median :0.000 Mode :character
## Mean :31.06 Mean :0.605
## 3rd Qu.:37.00 3rd Qu.:1.000
## Max. :61.00 Max. :6.000
## baja puesto salario_diario
## Min. :2021-11-27 Length:238 Min. :144.4
## 1st Qu.:2022-03-01 Class :character 1st Qu.:180.7
## Median :2022-04-29 Mode :character Median :180.7
## Mean :2022-04-29 Mean :178.0
## 3rd Qu.:2022-06-27 3rd Qu.:180.7
## Max. :2022-08-25 Max. :500.0
write.csv(bajas, file="rh_bajas_bd_limpia.csv", row.names = FALSE)
media_edad1 <- mean(bajas$edad)
media_edad1
## [1] 31.05882
media_antiguedad1 <- mean(bajas$antiguedad)
media_antiguedad1
## [1] 0.605042
media_salario1 <- mean(bajas$salario_diario)
media_salario1
## [1] 177.9855
mediana_edad1 <- median(bajas$edad)
mediana_edad1
## [1] 29
mediana_antiguedad1 <- median(bajas$antiguedad)
mediana_antiguedad1
## [1] 0
mediana_salario1 <- median(bajas$salario_diario)
mediana_salario1
## [1] 180.68
mode <- function(x) {
ux <- unique(x)
ux[which.max(tabulate(match(x, ux)))]
}
moda_edad1 <- mode(bajas$edad)
moda_edad1
## [1] 22
moda_antiguedad1 <- mode(bajas$antiguedad)
moda_antiguedad1
## [1] 0
moda_salario1 <- mode(bajas$salario_diario)
moda_salario1
## [1] 180.68
varianza_edad1 <-var(bajas$edad)
varianza_edad1
## [1] 91.49863
varianza_antiguedad1 <-var(bajas$antiguedad)
varianza_antiguedad1
## [1] 0.6703542
varianza_salario1 <-var(bajas$salario_diario)
varianza_salario1
## [1] 536.4858
desviacion_edad1 <- sqrt(varianza_edad1)
desviacion_edad1
## [1] 9.565492
desviacion_antiguedad1 <- sqrt(varianza_antiguedad1)
desviacion_antiguedad1
## [1] 0.8187516
desviacion_salario1 <- sqrt(varianza_salario1)
desviacion_salario1
## [1] 23.16216
Variable1 <-c("Edad","Antiguedad","Salario Diario")
Promedio1 <-c("31.05","0.6","177.985")
Moda1 <-c("22","0","180.68")
Mediana1 <-c("29","0","180.68")
Varianza1 <-c("90.732","0.6677","531.996")
Desviación_Estándar1 <-c ("9.525","0.817","23.065")
tabla1 <-data.frame (Variable1,Promedio1, Moda1, Mediana1, Varianza1, Desviación_Estándar1)
tabla1
## Variable1 Promedio1 Moda1 Mediana1 Varianza1 Desviación_Estándar1
## 1 Edad 31.05 22 29 90.732 9.525
## 2 Antiguedad 0.6 0 0 0.6677 0.817
## 3 Salario Diario 177.985 180.68 180.68 531.996 23.065
knitr::kable(tabla1)
| Variable1 | Promedio1 | Moda1 | Mediana1 | Varianza1 | Desviación_Estándar1 |
|---|---|---|---|---|---|
| Edad | 31.05 | 22 | 29 | 90.732 | 9.525 |
| Antiguedad | 0.6 | 0 | 0 | 0.6677 | 0.817 |
| Salario Diario | 177.985 | 180.68 | 180.68 | 531.996 | 23.065 |
hist(bajas$edad, freq=TRUE, col="pink", main="Edad en años de los Ex-Colaboradores")
table(bajas$motivo_baja)
##
## ABANDONO BAJA POR FALTAS JUBILACION RENUNCIA VOLUNTARIA
## 1 141 1 87
## TERMINO DE CONTRATO
## 8
proporciones <- c(1, 141, 1, 87, 8)
etiquetas <- c("Abandono", "Baja por Faltas", "Jubilaciòn", "Renuncia Voluntaria", "Termino de Contrato")
pct <- round(proporciones/sum(proporciones)*100)
etiquetas <- paste(etiquetas, pct)
etiquetas <- paste(etiquetas,"%",sep="")
pie(proporciones,labels = etiquetas,
col=rainbow(length(etiquetas)),
main="Motivo de bajas de los Colaboradores")
#file.choose()
bd_prediccion <- read.csv("/Users/mayracampoyramos/Desktop/Analisis de Datos Concentracion/encoded-bd_prediccion.csv")
vehiculos_circulacion <- read.csv("/Users/mayracampoyramos/Desktop/Analisis de Datos Concentracion/encoded-vehiculos_en_circulacion (2).csv")
produccion <- read.csv("/Users/mayracampoyramos/Desktop/Analisis de Datos Concentracion/bd_produccion_limpia (1).csv")
#install.packages("tseries")
library(tseries)
#install.packages("forecast")
library(forecast)
#install.packages("astsa")
library(astsa)
#install.packages("dplyr")
library(dplyr)
#install.packages("jtools")
library(jtools)
#install.packages("lmtest")
library(lmtest)
#install.packages("car")
library(car)
#install.packages("olsrr")
library(olsrr)
#install.packages("corrplot")
library(corrplot)
summary(vehiculos_circulacion)
## Año Total Automóviles
## Length:47 Min. : 4010430 Min. : 3950042
## Class :character 1st Qu.: 6748523 1st Qu.: 6654340
## Mode :character Median :11002046 Median :10764080
## Mean :14899354 Mean :14673142
## 3rd Qu.:22392796 3rd Qu.:22068938
## Max. :35913468 Max. :35460804
## NA's :5 NA's :5
## Camiones.para.pasajeros Camiones.y.camionetas.para.carga Motocicletas
## Min. : 60388 Min. : 1470816 Min. : 128960
## 1st Qu.: 90931 1st Qu.: 3046906 1st Qu.: 248248
## Median :233490 Median : 5166812 Median : 295262
## Mean :226212 Mean : 5920971 Mean :1156467
## 3rd Qu.:336420 3rd Qu.: 9199181 3rd Qu.:1284405
## Max. :461089 Max. :11262666 Max. :5939262
## NA's :5 NA's :5 NA's :5
## X X.1
## Mode:logical Mode:logical
## NA's:47 NA's:47
##
##
##
##
##
str(vehiculos_circulacion)
## 'data.frame': 47 obs. of 8 variables:
## $ Año : chr "1980" "1981" "1982" "1983" ...
## $ Total : int 4010430 4406336 4686130 4797562 5047043 5360870 5286295 5420592 5682964 6093682 ...
## $ Automóviles : int 3950042 4341363 4616897 4726236 4970526 5281842 5202922 5336228 5597735 6003532 ...
## $ Camiones.para.pasajeros : int 60388 64973 69233 71326 76517 79028 83373 84364 85229 90150 ...
## $ Camiones.y.camionetas.para.carga: int 1470816 1636899 1751799 1893206 2009875 2114395 2213025 2292078 2424025 2691551 ...
## $ Motocicletas : int 277084 296601 257235 250484 248148 250358 232692 221059 217898 223815 ...
## $ X : logi NA NA NA NA NA NA ...
## $ X.1 : logi NA NA NA NA NA NA ...
vehiculos_circulacion1 <- subset(vehiculos_circulacion, select = -c (Camiones.y.camionetas.para.carga, Motocicletas, X, X.1))
vehiculos_circulacion1
## Año
## 1 1980
## 2 1981
## 3 1982
## 4 1983
## 5 1984
## 6 1985
## 7 1986
## 8 1987
## 9 1988
## 10 1989
## 11 1990
## 12 1991
## 13 1992
## 14 1993
## 15 1994
## 16 1995
## 17 1996
## 18 1997
## 19 1998
## 20 1999
## 21 2000
## 22 2001
## 23 2002
## 24 2003
## 25 2004
## 26 2005
## 27 2006
## 28 2007
## 29 2008
## 30 2009
## 31 2010
## 32 2011
## 33 2012
## 34 2013
## 35 2014
## 36 2015
## 37 2016
## 38 2017
## 39 2018
## 40 2019
## 41 2020
## 42 2021
## 43
## 44
## 45
## 46 FUENTE: INEGI. Estadísticas de vehículos de motor registrados en circulación.
## 47
## Total Automóviles Camiones.para.pasajeros
## 1 4010430 3950042 60388
## 2 4406336 4341363 64973
## 3 4686130 4616897 69233
## 4 4797562 4726236 71326
## 5 5047043 4970526 76517
## 6 5360870 5281842 79028
## 7 5286295 5202922 83373
## 8 5420592 5336228 84364
## 9 5682964 5597735 85229
## 10 6093682 6003532 90150
## 11 6648825 6555550 93275
## 12 7047618 6950708 96910
## 13 7494357 7399178 95179
## 14 7801892 7715951 85941
## 15 7332309 7217732 114577
## 16 7590001 7469504 120497
## 17 7927797 7830864 96933
## 18 8528440 8402995 125445
## 19 9262652 9086209 176443
## 20 9783153 9582796 200357
## 21 10378575 10176179 202396
## 22 11625518 11351982 273536
## 23 12554275 12254910 299365
## 24 13050150 12742049 308101
## 25 13652596 13388011 264585
## 26 14569197 14300380 268817
## 27 16722002 16411813 310189
## 28 18018701 17696623 322078
## 29 19754229 19420942 333287
## 30 20856689 20519224 337465
## 31 21465511 21152773 312738
## 32 22701891 22374326 327565
## 33 23908143 23569623 338520
## 34 25167066 24819922 347144
## 35 25891628 25543908 347720
## 36 27265446 26907994 357452
## 37 29032067 28664295 367772
## 38 31359162 30958042 401120
## 39 32733646 32290067 443579
## 40 34057197 33603591 453606
## 41 34886784 34425695 461089
## 42 35913468 35460804 452664
## 43 NA NA NA
## 44 NA NA NA
## 45 NA NA NA
## 46 NA NA NA
## 47 NA NA NA
vehiculos_circulacion2 <- vehiculos_circulacion1[-c(43,44,45,46,47),]
vehiculos_circulacion2
## Año Total Automóviles Camiones.para.pasajeros
## 1 1980 4010430 3950042 60388
## 2 1981 4406336 4341363 64973
## 3 1982 4686130 4616897 69233
## 4 1983 4797562 4726236 71326
## 5 1984 5047043 4970526 76517
## 6 1985 5360870 5281842 79028
## 7 1986 5286295 5202922 83373
## 8 1987 5420592 5336228 84364
## 9 1988 5682964 5597735 85229
## 10 1989 6093682 6003532 90150
## 11 1990 6648825 6555550 93275
## 12 1991 7047618 6950708 96910
## 13 1992 7494357 7399178 95179
## 14 1993 7801892 7715951 85941
## 15 1994 7332309 7217732 114577
## 16 1995 7590001 7469504 120497
## 17 1996 7927797 7830864 96933
## 18 1997 8528440 8402995 125445
## 19 1998 9262652 9086209 176443
## 20 1999 9783153 9582796 200357
## 21 2000 10378575 10176179 202396
## 22 2001 11625518 11351982 273536
## 23 2002 12554275 12254910 299365
## 24 2003 13050150 12742049 308101
## 25 2004 13652596 13388011 264585
## 26 2005 14569197 14300380 268817
## 27 2006 16722002 16411813 310189
## 28 2007 18018701 17696623 322078
## 29 2008 19754229 19420942 333287
## 30 2009 20856689 20519224 337465
## 31 2010 21465511 21152773 312738
## 32 2011 22701891 22374326 327565
## 33 2012 23908143 23569623 338520
## 34 2013 25167066 24819922 347144
## 35 2014 25891628 25543908 347720
## 36 2015 27265446 26907994 357452
## 37 2016 29032067 28664295 367772
## 38 2017 31359162 30958042 401120
## 39 2018 32733646 32290067 443579
## 40 2019 34057197 33603591 453606
## 41 2020 34886784 34425695 461089
## 42 2021 35913468 35460804 452664
summary(vehiculos_circulacion2)
## Año Total Automóviles
## Length:42 Min. : 4010430 Min. : 3950042
## Class :character 1st Qu.: 6748523 1st Qu.: 6654340
## Mode :character Median :11002046 Median :10764080
## Mean :14899354 Mean :14673142
## 3rd Qu.:22392796 3rd Qu.:22068938
## Max. :35913468 Max. :35460804
## Camiones.para.pasajeros
## Min. : 60388
## 1st Qu.: 90931
## Median :233490
## Mean :226212
## 3rd Qu.:336420
## Max. :461089
plot(vehiculos_circulacion2$Año,vehiculos_circulacion2$Total, type="l",col="blue", lwd=1.5, xlab ="Año",ylab ="Unidades", main = "Vehiculos de motor en circulación registrados anualmente")
lines(vehiculos_circulacion2$Año,vehiculos_circulacion2$Automóviles,col="red",lty=3)
legend("topleft", legend=c("Total de vehiculos en circulación", "Automóviles en circulación"),
col=c("blue", "red"), lty = 1:2, cex=0.8)
autoregressive_model <- arma(vehiculos_circulacion2$Total, order = c(1,0))
## Warning in arma(vehiculos_circulacion2$Total, order = c(1, 0)): Hessian
## negative-semidefinite
summary(autoregressive_model <- arma(vehiculos_circulacion2$Total, order = c(1,0)))
## Warning in arma(vehiculos_circulacion2$Total, order = c(1, 0)): Hessian
## negative-semidefinite
## Warning in sqrt(diag(object$vcov)): NaNs produced
## Warning in sqrt(diag(object$vcov)): NaNs produced
##
## Call:
## arma(x = vehiculos_circulacion2$Total, order = c(1, 0))
##
## Model:
## ARMA(1,0)
##
## Residuals:
## Min 1Q Median 3Q Max
## -964598 -203485 -37324 133579 1366807
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## ar1 1.043e+00 3.792e-03 275 <2e-16 ***
## intercept 1.595e+05 NaN NaN NaN
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Fit:
## sigma^2 estimated as 1.852e+11, Conditional Sum-of-Squares = 7.406257e+12, AIC = 1212.86
autoregressive_model_forecast<-forecast(autoregressive_model$fitted,h=5,level=c(95))
## Warning in ets(object, lambda = lambda, biasadj = biasadj,
## allow.multiplicative.trend = allow.multiplicative.trend, : Missing values
## encountered. Using longest contiguous portion of time series
autoregressive_model_forecast
## Point Forecast Lo 95 Hi 95
## 43 37884281 35240406 40528155
## 44 39222087 34802632 43641541
## 45 40559893 34284299 46835486
## 46 41897698 33625820 50169577
## 47 43235504 32811356 53659653
plot(autoregressive_model_forecast)
mam_circulacion <- arma(vehiculos_circulacion2$Total,order = c(1,1))
## Warning in arma(vehiculos_circulacion2$Total, order = c(1, 1)): Hessian
## negative-semidefinite
summary(mam_circulacion <- arma(vehiculos_circulacion2$Total,order = c(1,1)))
## Warning in arma(vehiculos_circulacion2$Total, order = c(1, 1)): Hessian
## negative-semidefinite
## Warning in sqrt(diag(object$vcov)): NaNs produced
## Warning in sqrt(diag(object$vcov)): NaNs produced
##
## Call:
## arma(x = vehiculos_circulacion2$Total, order = c(1, 1))
##
## Model:
## ARMA(1,1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -907766 -184323 -41323 113291 1305470
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## ar1 1.042e+00 4.680e-03 222.585 < 2e-16 ***
## ma1 3.442e-01 1.237e-01 2.783 0.00539 **
## intercept 1.767e+05 NaN NaN NaN
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Fit:
## sigma^2 estimated as 1.598e+11, Conditional Sum-of-Squares = 6.391897e+12, AIC = 1208.67
mam_circulacion_forecast <- forecast(mam_circulacion$fitted,h=5,level=c(95))
## Warning in ets(object, lambda = lambda, biasadj = biasadj,
## allow.multiplicative.trend = allow.multiplicative.trend, : Missing values
## encountered. Using longest contiguous portion of time series
mam_circulacion_forecast
## Point Forecast Lo 95 Hi 95
## 43 37635019 34318781 40951258
## 44 38948870 33832084 44065655
## 45 40262720 33315250 47210190
## 46 41576570 32704146 50448994
## 47 42890421 31977035 53803806
plot(mam_circulacion_forecast)
summary(produccion)
## fecha cliente piezas_prog tmo_min
## Length:3985 Length:3985 Min. : 0.0 Min. : 0.00
## Class :character Class :character 1st Qu.: 0.0 1st Qu.: 15.00
## Mode :character Mode :character Median : 51.0 Median : 20.00
## Mean : 102.1 Mean : 21.89
## 3rd Qu.: 184.0 3rd Qu.: 25.00
## Max. :1263.0 Max. :150.00
## estacion_arranque laminas_procesadas tiempo_calidad
## Length:3985 Min. : 0.0 Min. : 0.0000
## Class :character 1st Qu.: 0.0 1st Qu.: 1.0000
## Mode :character Median : 51.0 Median : 1.0000
## Mean : 102.1 Mean : 0.8754
## 3rd Qu.: 184.0 3rd Qu.: 1.0000
## Max. :1263.0 Max. :22.0000
str(produccion)
## 'data.frame': 3985 obs. of 7 variables:
## $ fecha : chr "16/07/2022" "22/07/2022" "28/07/2022" "12/08/2022" ...
## $ cliente : chr "TRMX" "STABILUS 3" "STABILUS 3" "TRMX" ...
## $ piezas_prog : int 3 2 2 1 1 1 0 2 5 5 ...
## $ tmo_min : int 10 10 10 10 10 10 10 10 10 10 ...
## $ estacion_arranque : chr "C1Y2" "C1Y2" "C1Y2" "C1" ...
## $ laminas_procesadas: int 3 2 2 1 1 1 0 2 5 5 ...
## $ tiempo_calidad : num 1 1 2 1 1 1 0 0 1 1 ...
produccion$cliente <- as.factor(produccion$cliente)
str(produccion)
## 'data.frame': 3985 obs. of 7 variables:
## $ fecha : chr "16/07/2022" "22/07/2022" "28/07/2022" "12/08/2022" ...
## $ cliente : Factor w/ 13 levels "DENSO","HANON SYSTEMS",..: 9 7 7 9 9 1 3 10 10 6 ...
## $ piezas_prog : int 3 2 2 1 1 1 0 2 5 5 ...
## $ tmo_min : int 10 10 10 10 10 10 10 10 10 10 ...
## $ estacion_arranque : chr "C1Y2" "C1Y2" "C1Y2" "C1" ...
## $ laminas_procesadas: int 3 2 2 1 1 1 0 2 5 5 ...
## $ tiempo_calidad : num 1 1 2 1 1 1 0 0 1 1 ...
summary(produccion)
## fecha cliente piezas_prog tmo_min
## Length:3985 STABILUS 1:1343 Min. : 0.0 Min. : 0.00
## Class :character TRMX : 686 1st Qu.: 0.0 1st Qu.: 15.00
## Mode :character STABILUS 3: 599 Median : 51.0 Median : 20.00
## YANFENG : 431 Mean : 102.1 Mean : 21.89
## DENSO : 399 3rd Qu.: 184.0 3rd Qu.: 25.00
## (Other) : 526 Max. :1263.0 Max. :150.00
## NA's : 1
## estacion_arranque laminas_procesadas tiempo_calidad
## Length:3985 Min. : 0.0 Min. : 0.0000
## Class :character 1st Qu.: 0.0 1st Qu.: 1.0000
## Mode :character Median : 51.0 Median : 1.0000
## Mean : 102.1 Mean : 0.8754
## 3rd Qu.: 184.0 3rd Qu.: 1.0000
## Max. :1263.0 Max. :22.0000
##
produccion1 <- produccion
produccion1<- produccion1[-c(624),]
summary (produccion1)
## fecha cliente piezas_prog tmo_min
## Length:3984 STABILUS 1:1343 Min. : 0.0 Min. : 0.00
## Class :character TRMX : 686 1st Qu.: 0.0 1st Qu.: 15.00
## Mode :character STABILUS 3: 599 Median : 51.0 Median : 20.00
## YANFENG : 431 Mean : 102.1 Mean : 21.89
## DENSO : 399 3rd Qu.: 184.0 3rd Qu.: 25.00
## VARROC : 269 Max. :1263.0 Max. :150.00
## (Other) : 257
## estacion_arranque laminas_procesadas tiempo_calidad
## Length:3984 Min. : 0.0 Min. : 0.0000
## Class :character 1st Qu.: 0.0 1st Qu.: 1.0000
## Mode :character Median : 51.0 Median : 1.0000
## Mean : 102.1 Mean : 0.8754
## 3rd Qu.: 184.0 3rd Qu.: 1.0000
## Max. :1263.0 Max. :22.0000
##
autoregressive_model_produccion <- arma(produccion1$piezas_prog, order = c(1,0))
summary(autoregressive_model_produccion <- arma(produccion1$piezas_prog, order = c(1,0)))
##
## Call:
## arma(x = produccion1$piezas_prog, order = c(1, 0))
##
## Model:
## ARMA(1,0)
##
## Residuals:
## Min 1Q Median 3Q Max
## -645.89 -52.84 -30.07 50.72 1191.16
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## ar1 0.48255 0.01388 34.77 <2e-16 ***
## intercept 52.84244 2.34226 22.56 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Fit:
## sigma^2 estimated as 13861, Conditional Sum-of-Squares = 55195736, AIC = 49304.94
autoregressive_model_produccion_forecast<-forecast(autoregressive_model_produccion$fitted,h=5,level=c(95))
## Warning in ets(object, lambda = lambda, biasadj = biasadj,
## allow.multiplicative.trend = allow.multiplicative.trend, : Missing values
## encountered. Using longest contiguous portion of time series
autoregressive_model_produccion_forecast
## Point Forecast Lo 95 Hi 95
## 3985 82.70478 3.234460 162.1751
## 3986 82.70478 3.191276 162.2183
## 3987 82.70478 3.148106 162.2614
## 3988 82.70478 3.104950 162.3046
## 3989 82.70478 3.061809 162.3477
plot(autoregressive_model_produccion_forecast)
mam_produccion <- arma(produccion1$piezas_prog,order = c(1,1))
summary(mam_produccion <- arma(produccion1$piezas_prog,order = c(1,1)))
##
## Call:
## arma(x = produccion1$piezas_prog, order = c(1, 1))
##
## Model:
## ARMA(1,1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -791.67 -53.47 -22.33 37.73 1208.91
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## ar1 0.83882 0.02370 35.400 < 2e-16 ***
## ma1 -0.51985 0.04204 -12.365 < 2e-16 ***
## intercept 16.48077 2.57279 6.406 1.5e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Fit:
## sigma^2 estimated as 13444, Conditional Sum-of-Squares = 53534365, AIC = 49185.18
mam_produccion_forecast <- forecast(mam_produccion$fitted,h=5,level=c(95))
## Warning in ets(object, lambda = lambda, biasadj = biasadj,
## allow.multiplicative.trend = allow.multiplicative.trend, : Missing values
## encountered. Using longest contiguous portion of time series
mam_produccion_forecast
## Point Forecast Lo 95 Hi 95
## 3985 165.7268 90.147513 241.3062
## 3986 165.7268 59.600542 271.8531
## 3987 165.7268 36.060547 295.3931
## 3988 165.7268 16.181181 315.2725
## 3989 165.7268 -1.349372 332.8031
plot(mam_produccion_forecast)
Se puede observar que no existe una tendencia específica.
summary(bd_prediccion)
## Año Mes Venta Producción
## Min. :2006 Min. : 1.00 Min. : 34927 Min. : 3722
## 1st Qu.:2010 1st Qu.: 3.00 1st Qu.: 78543 1st Qu.:189031
## Median :2014 Median : 6.00 Median : 88580 Median :248433
## Mean :2014 Mean : 6.42 Mean : 94178 Mean :241511
## 3rd Qu.:2018 3rd Qu.: 9.00 3rd Qu.:110134 3rd Qu.:292709
## Max. :2022 Max. :12.00 Max. :192741 Max. :382110
## NA's :2 NA's :2 NA's :2 NA's :2
## Exportación Tipo.de.cambio Inflación porcentaje_ocu
## Min. : 15139 Min. :10.09 Min. :-0.250 Min. :93.58
## 1st Qu.:153219 1st Qu.:12.66 1st Qu.: 0.815 1st Qu.:95.06
## Median :209160 Median :13.56 Median : 1.480 Median :95.88
## Mean :201664 Mean :15.48 Mean : 1.951 Mean :95.76
## 3rd Qu.:243900 3rd Qu.:19.10 3rd Qu.: 2.895 3rd Qu.:96.47
## Max. :327454 Max. :24.24 Max. : 7.360 Max. :97.16
## NA's :2 NA's :2 NA's :2 NA's :2
## porcentaje_desocu conf_consumidor
## Min. :2.840 Min. :28.67
## 1st Qu.:3.527 1st Qu.:36.69
## Median :4.125 Median :38.47
## Mean :4.244 Mean :39.15
## 3rd Qu.:4.940 3rd Qu.:42.59
## Max. :6.420 Max. :47.83
## NA's :2 NA's :2
str(bd_prediccion)
## 'data.frame': 202 obs. of 10 variables:
## $ Año : int 2006 2006 2006 2006 2006 2006 2006 2006 2006 2006 ...
## $ Mes : int 1 2 3 4 5 6 7 8 9 10 ...
## $ Venta : int 96227 89079 96871 77879 86462 87084 83069 90937 92083 97469 ...
## $ Producción : int 155291 166830 192643 132212 171557 194327 118602 179527 164577 179897 ...
## $ Exportación : int 112165 121001 153877 115798 131578 156008 85752 136114 125918 132470 ...
## $ Tipo.de.cambio : num 10.6 10.5 10.7 11 11.1 ...
## $ Inflación : num 0.59 0.74 0.87 1.01 0.56 0.65 0.93 1.44 2.47 2.91 ...
## $ porcentaje_ocu : num 96.5 96.2 96.7 96.8 97.2 ...
## $ porcentaje_desocu: num 3.48 3.75 3.31 3.2 2.84 3.26 4.01 3.87 4 3.82 ...
## $ conf_consumidor : num 43.9 43.9 45.6 44.8 44.7 ...
bd_prediccion1 <- subset(bd_prediccion, select = -c (Producción))
bd_prediccion1
## Año Mes Venta Exportación Tipo.de.cambio Inflación porcentaje_ocu
## 1 2006 1 96227 112165 10.56964 0.59 96.52
## 2 2006 2 89079 121001 10.48426 0.74 96.25
## 3 2006 3 96871 153877 10.69772 0.87 96.69
## 4 2006 4 77879 115798 11.02994 1.01 96.80
## 5 2006 5 86462 131578 11.07152 0.56 97.16
## 6 2006 6 87084 156008 11.38702 0.65 96.74
## 7 2006 7 83069 85752 11.03922 0.93 95.99
## 8 2006 8 90937 136114 10.87617 1.44 96.13
## 9 2006 9 92083 125918 10.97558 2.47 96.00
## 10 2006 10 97469 132470 10.91245 2.91 96.18
## 11 2006 11 102201 152396 10.87905 3.45 96.50
## 12 2006 12 140375 113718 10.87084 4.05 96.68
## 13 2007 1 97675 88915 10.93192 0.52 95.95
## 14 2007 2 86060 111084 10.98198 0.80 95.95
## 15 2007 3 96487 138877 11.12237 1.02 96.27
## 16 2007 4 75020 110462 10.99081 0.96 96.49
## 17 2007 5 84756 140387 10.83582 0.46 96.85
## 18 2007 6 80462 153243 10.83519 0.58 96.72
## 19 2007 7 83105 129581 10.79959 1.01 96.21
## 20 2007 8 88573 168210 11.04243 1.42 96.17
## 21 2007 9 86547 156237 11.03762 2.21 96.24
## 22 2007 10 97182 144970 10.84063 2.61 96.23
## 23 2007 11 97694 149964 10.85821 3.33 96.65
## 24 2007 12 126329 121383 10.85206 3.76 96.89
## 25 2008 1 96846 118416 10.91741 0.46 95.88
## 26 2008 2 86997 140501 10.78461 0.76 96.11
## 27 2008 3 80119 129405 10.73085 1.49 96.39
## 28 2008 4 83106 144234 10.52556 1.72 96.52
## 29 2008 5 85827 150514 10.45804 1.61 96.71
## 30 2008 6 81424 153345 10.32862 2.03 96.63
## 31 2008 7 85324 122144 10.23761 2.60 95.87
## 32 2008 8 86119 143464 10.09196 3.20 95.94
## 33 2008 9 76620 144454 10.60434 3.90 95.86
## 34 2008 10 83307 167497 12.48947 4.61 95.83
## 35 2008 11 78555 138439 13.09469 5.80 95.68
## 36 2008 12 101300 109206 13.37363 6.53 95.98
## 37 2009 1 69664 51061 13.86394 0.23 94.99
## 38 2009 2 61579 77833 14.50219 0.45 94.76
## 39 2009 3 64242 101830 14.72083 1.03 95.34
## 40 2009 4 51395 85121 13.47903 1.38 94.94
## 41 2009 5 53440 83910 13.25065 1.09 94.77
## 42 2009 6 55974 84934 13.34374 1.28 95.02
## 43 2009 7 56443 90872 13.36679 1.55 94.18
## 44 2009 8 58926 111273 13.01394 1.79 93.85
## 45 2009 9 58505 117433 13.40757 2.30 93.58
## 46 2009 10 67882 145761 13.25259 2.61 94.33
## 47 2009 11 64914 134873 13.13145 3.15 94.89
## 48 2009 12 91961 138432 12.85556 3.57 95.27
## 49 2010 1 64064 114193 12.83263 1.09 94.24
## 50 2010 2 59518 153148 12.96185 1.67 94.72
## 51 2010 3 65414 163641 12.60465 2.39 95.26
## 52 2010 4 60432 133406 12.26208 2.07 94.65
## 53 2010 5 61632 145909 12.68247 1.42 95.00
## 54 2010 6 59910 177575 12.71818 1.39 95.08
## 55 2010 7 61960 143521 12.83341 1.61 94.41
## 56 2010 8 66931 175904 12.72952 1.89 94.58
## 57 2010 9 65934 169507 12.86421 2.43 94.34
## 58 2010 10 74095 166931 12.45569 3.06 94.52
## 59 2010 11 75582 168226 12.31381 3.89 94.83
## 60 2010 12 104941 147551 12.40058 4.40 95.06
## 61 2011 1 68767 165045 12.15321 0.49 94.66
## 62 2011 2 66990 155808 12.07712 0.86 94.66
## 63 2011 3 75125 192783 12.01917 1.06 95.36
## 64 2011 4 65246 141334 11.75536 1.05 94.87
## 65 2011 5 68634 176951 11.65234 0.30 94.82
## 66 2011 6 68366 188223 11.80157 0.30 94.60
## 67 2011 7 68533 196835 11.67069 0.78 94.52
## 68 2011 8 75681 170086 12.20000 0.94 94.29
## 69 2011 9 73998 193590 13.08912 1.19 94.57
## 70 2011 10 75748 192244 13.46868 1.87 95.01
## 71 2011 11 83107 199665 13.63712 2.97 95.04
## 72 2011 12 115698 171319 13.74813 3.82 95.49
## 73 2012 1 75297 156417 13.48802 0.71 95.12
## 74 2012 2 74704 197600 12.80356 0.91 94.72
## 75 2012 3 83574 226555 12.75781 0.97 95.48
## 76 2012 4 69890 180545 13.02576 0.65 95.14
## 77 2012 5 80268 184302 13.53816 0.34 95.33
## 78 2012 6 78508 229089 13.97611 0.80 95.25
## 79 2012 7 76378 208151 13.39195 1.36 95.01
## 80 2012 8 83326 188392 13.18333 1.67 94.67
## 81 2012 9 79961 193350 13.00449 2.12 95.09
## 82 2012 10 83172 216576 12.86915 2.63 94.97
## 83 2012 11 91966 219864 12.86915 3.33 94.95
## 84 2012 12 110998 154724 12.87298 3.57 95.60
## 85 2013 1 84403 178562 12.71282 0.40 94.59
## 86 2013 2 80285 175338 12.71638 0.90 95.25
## 87 2013 3 82860 204475 12.40242 1.64 95.52
## 88 2013 4 83647 185548 12.21560 1.70 95.04
## 89 2013 5 87638 191205 12.23945 1.37 95.09
## 90 2013 6 83858 225753 12.95020 1.30 95.00
## 91 2013 7 86760 192940 12.76920 1.27 94.87
## 92 2013 8 88586 226893 12.88348 1.56 94.82
## 93 2013 9 78555 215962 13.08974 1.94 94.69
## 94 2013 10 88416 240316 13.02170 2.43 94.99
## 95 2013 11 100571 224873 13.06409 3.38 95.52
## 96 2013 12 119519 161208 13.00105 3.97 95.73
## 97 2014 1 85614 177928 13.20104 0.89 94.93
## 98 2014 2 80037 197504 13.29067 1.15 95.34
## 99 2014 3 85767 230772 13.21485 1.43 95.20
## 100 2014 4 76941 202328 13.07712 1.24 95.15
## 101 2014 5 88388 234629 12.95623 0.91 95.06
## 102 2014 6 84207 230410 12.97570 1.09 95.18
## 103 2014 7 96366 231934 12.97300 1.37 94.53
## 104 2014 8 103994 226757 13.15002 1.73 94.81
## 105 2014 9 89313 220239 13.21131 2.18 94.91
## 106 2014 10 101090 257382 13.47454 2.74 95.22
## 107 2014 11 111837 237923 13.59030 3.57 95.47
## 108 2014 12 133411 195091 14.45304 4.08 96.24
## 109 2015 1 103805 204907 14.67395 -0.09 95.49
## 110 2015 2 97659 222351 14.90437 0.10 95.67
## 111 2015 3 105034 261256 15.20997 0.51 96.14
## 112 2015 4 94953 233515 15.22746 0.25 95.69
## 113 2015 5 102156 240709 15.25361 -0.25 95.55
## 114 2015 6 107097 242720 15.45056 -0.09 95.59
## 115 2015 7 111863 226511 15.87623 0.06 95.28
## 116 2015 8 112307 234668 16.50888 0.27 95.32
## 117 2015 9 111705 216587 16.83229 0.65 95.50
## 118 2015 10 120214 245224 16.59932 1.16 95.45
## 119 2015 11 126750 223797 16.63219 1.72 96.04
## 120 2015 12 160901 206651 17.01278 2.13 96.04
## 121 2016 1 119833 213244 17.94565 0.38 95.74
## 122 2016 2 111126 219670 18.45920 0.82 95.86
## 123 2016 3 117252 224184 17.67208 0.97 96.25
## 124 2016 4 118754 197020 17.48096 0.65 96.20
## 125 2016 5 121879 226240 18.05380 0.20 95.99
## 126 2016 6 134913 247005 18.62127 0.31 96.08
## 127 2016 7 132109 225530 18.58811 0.57 96.00
## 128 2016 8 134388 262673 18.46011 0.86 96.02
## 129 2016 9 131888 235612 19.11921 1.47 95.88
## 130 2016 10 137503 255115 18.97319 2.09 96.33
## 131 2016 11 154779 245330 19.96946 2.89 96.50
## 132 2016 12 192741 216645 20.54282 3.36 96.62
## 133 2017 1 123447 219061 21.39550 1.70 96.40
## 134 2017 2 118193 248288 20.35246 2.29 96.66
## 135 2017 3 137245 305403 19.41648 2.92 96.81
## 136 2017 4 114938 240141 18.78122 3.04 96.53
## 137 2017 5 123429 269067 18.79971 2.92 96.45
## 138 2017 6 127752 287979 18.20815 3.18 96.71
## 139 2017 7 122678 258557 17.85459 3.57 96.58
## 140 2017 8 125985 276108 17.80650 4.08 96.48
## 141 2017 9 116716 286400 17.80554 4.41 96.41
## 142 2017 10 123602 303514 18.71362 5.06 96.49
## 143 2017 11 141724 290569 18.98973 6.15 96.59
## 144 2017 12 159234 268772 19.10129 6.77 96.85
## 145 2018 1 109445 231088 19.02896 0.53 96.64
## 146 2018 2 109846 271228 18.61594 0.91 96.83
## 147 2018 3 119127 317398 18.65489 1.24 97.06
## 148 2018 4 109748 271048 18.34659 0.90 96.61
## 149 2018 5 115155 288659 19.45515 0.73 96.78
## 150 2018 6 120298 315130 20.31281 1.12 96.63
## 151 2018 7 115047 247367 19.09664 1.66 96.53
## 152 2018 8 119487 322779 18.80423 2.26 96.54
## 153 2018 9 114888 306009 19.03592 2.69 96.42
## 154 2018 10 117602 313471 19.09212 3.22 96.73
## 155 2018 11 134143 291018 20.25495 4.10 96.75
## 156 2018 12 142300 275962 20.15294 4.83 96.64
## 157 2019 1 111514 243652 19.22744 0.09 96.44
## 158 2019 2 104009 273173 19.18334 0.06 96.71
## 159 2019 3 117529 325703 19.24878 0.44 96.78
## 160 2019 4 98366 288756 19.01630 0.50 96.50
## 161 2019 5 102422 309017 19.09191 0.21 96.50
## 162 2019 6 106782 327454 19.26678 0.27 96.43
## 163 2019 7 106104 276818 19.06189 0.65 96.26
## 164 2019 8 108074 286075 19.58659 0.63 96.29
## 165 2019 9 100757 286806 19.60990 0.89 96.22
## 166 2019 10 107110 259158 19.36886 1.44 96.31
## 167 2019 11 124804 274845 19.30748 2.26 96.58
## 168 2019 12 130460 236848 19.16932 2.83 97.09
## 169 2020 1 104852 238749 18.81445 0.48 96.22
## 170 2020 2 104338 273634 18.77705 0.90 96.47
## 171 2020 3 87541 295199 21.97384 0.85 97.09
## 172 2020 4 34927 31183 24.23988 -0.17 95.31
## 173 2020 5 42034 15139 23.58032 0.22 95.81
## 174 2020 6 62861 198084 22.26918 0.76 94.51
## 175 2020 7 72921 264520 22.48030 1.43 94.65
## 176 2020 8 77120 264478 22.23107 1.82 94.74
## 177 2020 9 77808 257562 21.60516 2.06 94.87
## 178 2020 10 84351 280474 21.38085 2.68 95.29
## 179 2020 11 95707 287703 20.53330 2.76 95.65
## 180 2020 12 105603 275081 19.97817 3.15 96.21
## 181 2021 1 81657 223533 19.90262 0.86 95.30
## 182 2021 2 82863 213987 20.29248 1.50 95.60
## 183 2021 3 96319 256119 20.76205 2.34 96.13
## 184 2021 4 84287 234584 20.10944 2.67 95.35
## 185 2021 5 86710 242020 20.05320 2.88 96.01
## 186 2021 6 88688 234394 20.04272 3.43 95.98
## 187 2021 7 82157 202021 19.98552 4.04 95.62
## 188 2021 8 78235 212687 20.05125 4.24 95.67
## 189 2021 9 76930 195294 19.99092 4.88 95.82
## 190 2021 10 76640 224535 20.47244 5.76 96.05
## 191 2021 11 82829 240341 20.78256 6.97 96.34
## 192 2021 12 97420 227465 20.98530 7.36 96.49
## 193 2022 1 78585 216630 20.48354 0.59 96.29
## 194 2022 2 79598 201868 20.48437 1.43 96.26
## 195 2022 3 95199 262494 20.60089 2.43 97.03
## 196 2022 4 83459 241286 20.04452 2.98 96.97
## 197 2022 5 91215 244643 20.11331 3.17 96.73
## 198 2022 6 90368 237674 19.96650 4.04 96.65
## 199 2022 7 83137 210170 20.53081 4.81 96.57
## 200 2022 8 91124 248704 20.12613 5.54 96.47
## 201 NA NA NA NA NA NA NA
## 202 NA NA NA NA NA NA NA
## porcentaje_desocu conf_consumidor
## 1 3.48 43.9415
## 2 3.75 43.9100
## 3 3.31 45.6029
## 4 3.20 44.7854
## 5 2.84 44.6508
## 6 3.26 44.2339
## 7 4.01 44.8674
## 8 3.87 45.0383
## 9 4.00 45.0604
## 10 3.82 44.3016
## 11 3.50 43.1883
## 12 3.32 44.7871
## 13 4.05 42.7412
## 14 4.05 42.3778
## 15 3.73 43.5677
## 16 3.51 43.4415
## 17 3.15 43.7534
## 18 3.28 43.0694
## 19 3.79 42.9629
## 20 3.83 43.9863
## 21 3.76 43.0238
## 22 3.77 41.2666
## 23 3.35 40.8568
## 24 3.11 42.8202
## 25 4.12 42.1822
## 26 3.89 41.2208
## 27 3.61 41.8964
## 28 3.48 40.1531
## 29 3.29 38.9120
## 30 3.37 37.6903
## 31 4.13 36.7035
## 32 4.06 37.2616
## 33 4.14 36.6558
## 34 4.17 34.2078
## 35 4.32 34.9500
## 36 4.02 34.9987
## 37 5.01 34.4084
## 38 5.24 33.4023
## 39 4.66 33.4728
## 40 5.06 34.6003
## 41 5.23 33.1933
## 42 4.98 34.2256
## 43 5.82 36.0502
## 44 6.15 34.5306
## 45 6.42 34.4993
## 46 5.67 32.6096
## 47 5.11 33.1707
## 48 4.73 33.9865
## 49 5.76 34.8020
## 50 5.28 34.2586
## 51 4.74 34.6691
## 52 5.35 35.0361
## 53 5.00 35.5938
## 54 4.92 36.7799
## 55 5.59 36.9279
## 56 5.42 37.2006
## 57 5.66 38.3303
## 58 5.48 37.4086
## 59 5.17 37.1774
## 60 4.94 38.1767
## 61 5.34 38.4624
## 62 5.34 38.4413
## 63 4.64 38.3233
## 64 5.13 37.6265
## 65 5.18 37.3597
## 66 5.40 38.7674
## 67 5.48 39.7537
## 68 5.71 38.9023
## 69 5.43 38.4823
## 70 4.99 37.7094
## 71 4.96 37.4238
## 72 4.51 37.7149
## 73 4.88 39.3604
## 74 5.28 38.9804
## 75 4.52 38.8750
## 76 4.86 40.2245
## 77 4.67 39.7323
## 78 4.75 39.7133
## 79 4.99 41.1478
## 80 5.33 40.7832
## 81 4.91 39.3550
## 82 5.03 39.6293
## 83 5.05 39.1214
## 84 4.40 41.1395
## 85 5.41 41.6134
## 86 4.75 39.6882
## 87 4.48 39.9339
## 88 4.96 39.8361
## 89 4.91 39.4471
## 90 5.00 38.7706
## 91 5.13 40.6562
## 92 5.18 40.5308
## 93 5.31 39.1825
## 94 5.01 38.0775
## 95 4.48 36.9465
## 96 4.27 37.3707
## 97 5.07 35.5508
## 98 4.66 35.7346
## 99 4.80 37.1351
## 100 4.85 37.6101
## 101 4.94 37.7513
## 102 4.82 37.9049
## 103 5.47 37.5518
## 104 5.19 37.4502
## 105 5.09 38.2199
## 106 4.78 37.6935
## 107 4.53 38.4760
## 108 3.76 38.6914
## 109 4.51 38.0625
## 110 4.33 37.4911
## 111 3.86 38.5052
## 112 4.31 37.8429
## 113 4.45 38.0317
## 114 4.41 39.1119
## 115 4.72 38.1319
## 116 4.68 37.3836
## 117 4.50 37.4490
## 118 4.55 37.8131
## 119 3.96 38.1829
## 120 3.96 38.3685
## 121 4.26 38.1815
## 122 4.14 36.7321
## 123 3.75 36.8144
## 124 3.80 36.7139
## 125 4.01 37.4848
## 126 3.92 38.3491
## 127 4.00 36.5060
## 128 3.98 35.6554
## 129 4.12 34.7550
## 130 3.67 35.0319
## 131 3.50 34.8752
## 132 3.38 35.4784
## 133 3.60 28.6679
## 134 3.34 31.5156
## 135 3.19 33.7951
## 136 3.47 34.9345
## 137 3.55 35.8733
## 138 3.29 36.0104
## 139 3.42 36.4886
## 140 3.52 36.5055
## 141 3.59 36.7879
## 142 3.51 36.4370
## 143 3.41 36.7168
## 144 3.15 36.3155
## 145 3.36 34.8018
## 146 3.17 34.1893
## 147 2.94 34.3367
## 148 3.39 35.6116
## 149 3.22 36.6479
## 150 3.37 37.1483
## 151 3.47 43.3411
## 152 3.46 43.0057
## 153 3.58 42.1327
## 154 3.27 42.5330
## 155 3.25 41.6750
## 156 3.36 44.8654
## 157 3.56 45.9299
## 158 3.29 47.8261
## 159 3.22 46.3411
## 160 3.50 45.4850
## 161 3.50 44.3235
## 162 3.57 43.6658
## 163 3.74 43.3177
## 164 3.71 43.8192
## 165 3.78 45.2995
## 166 3.69 44.0597
## 167 3.42 43.8407
## 168 2.91 43.7574
## 169 3.78 44.1205
## 170 3.53 43.3299
## 171 2.91 42.0593
## 172 4.69 32.2235
## 173 4.19 31.0682
## 174 5.49 31.9572
## 175 5.35 34.4173
## 176 5.26 35.0648
## 177 5.13 36.2820
## 178 4.71 37.8912
## 179 4.35 37.0767
## 180 3.79 38.7487
## 181 4.70 39.2114
## 182 4.40 38.6401
## 183 3.87 40.5816
## 184 4.65 42.5091
## 185 3.99 42.4227
## 186 4.02 44.3477
## 187 4.38 44.2934
## 188 4.33 42.4746
## 189 4.18 43.3421
## 190 3.95 43.8431
## 191 3.66 45.9354
## 192 3.51 44.8964
## 193 3.71 43.5909
## 194 3.74 42.9401
## 195 2.97 43.5603
## 196 3.03 44.3017
## 197 3.27 43.7823
## 198 3.35 43.2086
## 199 3.43 41.2699
## 200 3.53 40.2979
## 201 NA NA
## 202 NA NA
bd_prediccion2 <- bd_prediccion1[-c(201, 202),]
bd_prediccion2
## Año Mes Venta Exportación Tipo.de.cambio Inflación porcentaje_ocu
## 1 2006 1 96227 112165 10.56964 0.59 96.52
## 2 2006 2 89079 121001 10.48426 0.74 96.25
## 3 2006 3 96871 153877 10.69772 0.87 96.69
## 4 2006 4 77879 115798 11.02994 1.01 96.80
## 5 2006 5 86462 131578 11.07152 0.56 97.16
## 6 2006 6 87084 156008 11.38702 0.65 96.74
## 7 2006 7 83069 85752 11.03922 0.93 95.99
## 8 2006 8 90937 136114 10.87617 1.44 96.13
## 9 2006 9 92083 125918 10.97558 2.47 96.00
## 10 2006 10 97469 132470 10.91245 2.91 96.18
## 11 2006 11 102201 152396 10.87905 3.45 96.50
## 12 2006 12 140375 113718 10.87084 4.05 96.68
## 13 2007 1 97675 88915 10.93192 0.52 95.95
## 14 2007 2 86060 111084 10.98198 0.80 95.95
## 15 2007 3 96487 138877 11.12237 1.02 96.27
## 16 2007 4 75020 110462 10.99081 0.96 96.49
## 17 2007 5 84756 140387 10.83582 0.46 96.85
## 18 2007 6 80462 153243 10.83519 0.58 96.72
## 19 2007 7 83105 129581 10.79959 1.01 96.21
## 20 2007 8 88573 168210 11.04243 1.42 96.17
## 21 2007 9 86547 156237 11.03762 2.21 96.24
## 22 2007 10 97182 144970 10.84063 2.61 96.23
## 23 2007 11 97694 149964 10.85821 3.33 96.65
## 24 2007 12 126329 121383 10.85206 3.76 96.89
## 25 2008 1 96846 118416 10.91741 0.46 95.88
## 26 2008 2 86997 140501 10.78461 0.76 96.11
## 27 2008 3 80119 129405 10.73085 1.49 96.39
## 28 2008 4 83106 144234 10.52556 1.72 96.52
## 29 2008 5 85827 150514 10.45804 1.61 96.71
## 30 2008 6 81424 153345 10.32862 2.03 96.63
## 31 2008 7 85324 122144 10.23761 2.60 95.87
## 32 2008 8 86119 143464 10.09196 3.20 95.94
## 33 2008 9 76620 144454 10.60434 3.90 95.86
## 34 2008 10 83307 167497 12.48947 4.61 95.83
## 35 2008 11 78555 138439 13.09469 5.80 95.68
## 36 2008 12 101300 109206 13.37363 6.53 95.98
## 37 2009 1 69664 51061 13.86394 0.23 94.99
## 38 2009 2 61579 77833 14.50219 0.45 94.76
## 39 2009 3 64242 101830 14.72083 1.03 95.34
## 40 2009 4 51395 85121 13.47903 1.38 94.94
## 41 2009 5 53440 83910 13.25065 1.09 94.77
## 42 2009 6 55974 84934 13.34374 1.28 95.02
## 43 2009 7 56443 90872 13.36679 1.55 94.18
## 44 2009 8 58926 111273 13.01394 1.79 93.85
## 45 2009 9 58505 117433 13.40757 2.30 93.58
## 46 2009 10 67882 145761 13.25259 2.61 94.33
## 47 2009 11 64914 134873 13.13145 3.15 94.89
## 48 2009 12 91961 138432 12.85556 3.57 95.27
## 49 2010 1 64064 114193 12.83263 1.09 94.24
## 50 2010 2 59518 153148 12.96185 1.67 94.72
## 51 2010 3 65414 163641 12.60465 2.39 95.26
## 52 2010 4 60432 133406 12.26208 2.07 94.65
## 53 2010 5 61632 145909 12.68247 1.42 95.00
## 54 2010 6 59910 177575 12.71818 1.39 95.08
## 55 2010 7 61960 143521 12.83341 1.61 94.41
## 56 2010 8 66931 175904 12.72952 1.89 94.58
## 57 2010 9 65934 169507 12.86421 2.43 94.34
## 58 2010 10 74095 166931 12.45569 3.06 94.52
## 59 2010 11 75582 168226 12.31381 3.89 94.83
## 60 2010 12 104941 147551 12.40058 4.40 95.06
## 61 2011 1 68767 165045 12.15321 0.49 94.66
## 62 2011 2 66990 155808 12.07712 0.86 94.66
## 63 2011 3 75125 192783 12.01917 1.06 95.36
## 64 2011 4 65246 141334 11.75536 1.05 94.87
## 65 2011 5 68634 176951 11.65234 0.30 94.82
## 66 2011 6 68366 188223 11.80157 0.30 94.60
## 67 2011 7 68533 196835 11.67069 0.78 94.52
## 68 2011 8 75681 170086 12.20000 0.94 94.29
## 69 2011 9 73998 193590 13.08912 1.19 94.57
## 70 2011 10 75748 192244 13.46868 1.87 95.01
## 71 2011 11 83107 199665 13.63712 2.97 95.04
## 72 2011 12 115698 171319 13.74813 3.82 95.49
## 73 2012 1 75297 156417 13.48802 0.71 95.12
## 74 2012 2 74704 197600 12.80356 0.91 94.72
## 75 2012 3 83574 226555 12.75781 0.97 95.48
## 76 2012 4 69890 180545 13.02576 0.65 95.14
## 77 2012 5 80268 184302 13.53816 0.34 95.33
## 78 2012 6 78508 229089 13.97611 0.80 95.25
## 79 2012 7 76378 208151 13.39195 1.36 95.01
## 80 2012 8 83326 188392 13.18333 1.67 94.67
## 81 2012 9 79961 193350 13.00449 2.12 95.09
## 82 2012 10 83172 216576 12.86915 2.63 94.97
## 83 2012 11 91966 219864 12.86915 3.33 94.95
## 84 2012 12 110998 154724 12.87298 3.57 95.60
## 85 2013 1 84403 178562 12.71282 0.40 94.59
## 86 2013 2 80285 175338 12.71638 0.90 95.25
## 87 2013 3 82860 204475 12.40242 1.64 95.52
## 88 2013 4 83647 185548 12.21560 1.70 95.04
## 89 2013 5 87638 191205 12.23945 1.37 95.09
## 90 2013 6 83858 225753 12.95020 1.30 95.00
## 91 2013 7 86760 192940 12.76920 1.27 94.87
## 92 2013 8 88586 226893 12.88348 1.56 94.82
## 93 2013 9 78555 215962 13.08974 1.94 94.69
## 94 2013 10 88416 240316 13.02170 2.43 94.99
## 95 2013 11 100571 224873 13.06409 3.38 95.52
## 96 2013 12 119519 161208 13.00105 3.97 95.73
## 97 2014 1 85614 177928 13.20104 0.89 94.93
## 98 2014 2 80037 197504 13.29067 1.15 95.34
## 99 2014 3 85767 230772 13.21485 1.43 95.20
## 100 2014 4 76941 202328 13.07712 1.24 95.15
## 101 2014 5 88388 234629 12.95623 0.91 95.06
## 102 2014 6 84207 230410 12.97570 1.09 95.18
## 103 2014 7 96366 231934 12.97300 1.37 94.53
## 104 2014 8 103994 226757 13.15002 1.73 94.81
## 105 2014 9 89313 220239 13.21131 2.18 94.91
## 106 2014 10 101090 257382 13.47454 2.74 95.22
## 107 2014 11 111837 237923 13.59030 3.57 95.47
## 108 2014 12 133411 195091 14.45304 4.08 96.24
## 109 2015 1 103805 204907 14.67395 -0.09 95.49
## 110 2015 2 97659 222351 14.90437 0.10 95.67
## 111 2015 3 105034 261256 15.20997 0.51 96.14
## 112 2015 4 94953 233515 15.22746 0.25 95.69
## 113 2015 5 102156 240709 15.25361 -0.25 95.55
## 114 2015 6 107097 242720 15.45056 -0.09 95.59
## 115 2015 7 111863 226511 15.87623 0.06 95.28
## 116 2015 8 112307 234668 16.50888 0.27 95.32
## 117 2015 9 111705 216587 16.83229 0.65 95.50
## 118 2015 10 120214 245224 16.59932 1.16 95.45
## 119 2015 11 126750 223797 16.63219 1.72 96.04
## 120 2015 12 160901 206651 17.01278 2.13 96.04
## 121 2016 1 119833 213244 17.94565 0.38 95.74
## 122 2016 2 111126 219670 18.45920 0.82 95.86
## 123 2016 3 117252 224184 17.67208 0.97 96.25
## 124 2016 4 118754 197020 17.48096 0.65 96.20
## 125 2016 5 121879 226240 18.05380 0.20 95.99
## 126 2016 6 134913 247005 18.62127 0.31 96.08
## 127 2016 7 132109 225530 18.58811 0.57 96.00
## 128 2016 8 134388 262673 18.46011 0.86 96.02
## 129 2016 9 131888 235612 19.11921 1.47 95.88
## 130 2016 10 137503 255115 18.97319 2.09 96.33
## 131 2016 11 154779 245330 19.96946 2.89 96.50
## 132 2016 12 192741 216645 20.54282 3.36 96.62
## 133 2017 1 123447 219061 21.39550 1.70 96.40
## 134 2017 2 118193 248288 20.35246 2.29 96.66
## 135 2017 3 137245 305403 19.41648 2.92 96.81
## 136 2017 4 114938 240141 18.78122 3.04 96.53
## 137 2017 5 123429 269067 18.79971 2.92 96.45
## 138 2017 6 127752 287979 18.20815 3.18 96.71
## 139 2017 7 122678 258557 17.85459 3.57 96.58
## 140 2017 8 125985 276108 17.80650 4.08 96.48
## 141 2017 9 116716 286400 17.80554 4.41 96.41
## 142 2017 10 123602 303514 18.71362 5.06 96.49
## 143 2017 11 141724 290569 18.98973 6.15 96.59
## 144 2017 12 159234 268772 19.10129 6.77 96.85
## 145 2018 1 109445 231088 19.02896 0.53 96.64
## 146 2018 2 109846 271228 18.61594 0.91 96.83
## 147 2018 3 119127 317398 18.65489 1.24 97.06
## 148 2018 4 109748 271048 18.34659 0.90 96.61
## 149 2018 5 115155 288659 19.45515 0.73 96.78
## 150 2018 6 120298 315130 20.31281 1.12 96.63
## 151 2018 7 115047 247367 19.09664 1.66 96.53
## 152 2018 8 119487 322779 18.80423 2.26 96.54
## 153 2018 9 114888 306009 19.03592 2.69 96.42
## 154 2018 10 117602 313471 19.09212 3.22 96.73
## 155 2018 11 134143 291018 20.25495 4.10 96.75
## 156 2018 12 142300 275962 20.15294 4.83 96.64
## 157 2019 1 111514 243652 19.22744 0.09 96.44
## 158 2019 2 104009 273173 19.18334 0.06 96.71
## 159 2019 3 117529 325703 19.24878 0.44 96.78
## 160 2019 4 98366 288756 19.01630 0.50 96.50
## 161 2019 5 102422 309017 19.09191 0.21 96.50
## 162 2019 6 106782 327454 19.26678 0.27 96.43
## 163 2019 7 106104 276818 19.06189 0.65 96.26
## 164 2019 8 108074 286075 19.58659 0.63 96.29
## 165 2019 9 100757 286806 19.60990 0.89 96.22
## 166 2019 10 107110 259158 19.36886 1.44 96.31
## 167 2019 11 124804 274845 19.30748 2.26 96.58
## 168 2019 12 130460 236848 19.16932 2.83 97.09
## 169 2020 1 104852 238749 18.81445 0.48 96.22
## 170 2020 2 104338 273634 18.77705 0.90 96.47
## 171 2020 3 87541 295199 21.97384 0.85 97.09
## 172 2020 4 34927 31183 24.23988 -0.17 95.31
## 173 2020 5 42034 15139 23.58032 0.22 95.81
## 174 2020 6 62861 198084 22.26918 0.76 94.51
## 175 2020 7 72921 264520 22.48030 1.43 94.65
## 176 2020 8 77120 264478 22.23107 1.82 94.74
## 177 2020 9 77808 257562 21.60516 2.06 94.87
## 178 2020 10 84351 280474 21.38085 2.68 95.29
## 179 2020 11 95707 287703 20.53330 2.76 95.65
## 180 2020 12 105603 275081 19.97817 3.15 96.21
## 181 2021 1 81657 223533 19.90262 0.86 95.30
## 182 2021 2 82863 213987 20.29248 1.50 95.60
## 183 2021 3 96319 256119 20.76205 2.34 96.13
## 184 2021 4 84287 234584 20.10944 2.67 95.35
## 185 2021 5 86710 242020 20.05320 2.88 96.01
## 186 2021 6 88688 234394 20.04272 3.43 95.98
## 187 2021 7 82157 202021 19.98552 4.04 95.62
## 188 2021 8 78235 212687 20.05125 4.24 95.67
## 189 2021 9 76930 195294 19.99092 4.88 95.82
## 190 2021 10 76640 224535 20.47244 5.76 96.05
## 191 2021 11 82829 240341 20.78256 6.97 96.34
## 192 2021 12 97420 227465 20.98530 7.36 96.49
## 193 2022 1 78585 216630 20.48354 0.59 96.29
## 194 2022 2 79598 201868 20.48437 1.43 96.26
## 195 2022 3 95199 262494 20.60089 2.43 97.03
## 196 2022 4 83459 241286 20.04452 2.98 96.97
## 197 2022 5 91215 244643 20.11331 3.17 96.73
## 198 2022 6 90368 237674 19.96650 4.04 96.65
## 199 2022 7 83137 210170 20.53081 4.81 96.57
## 200 2022 8 91124 248704 20.12613 5.54 96.47
## porcentaje_desocu conf_consumidor
## 1 3.48 43.9415
## 2 3.75 43.9100
## 3 3.31 45.6029
## 4 3.20 44.7854
## 5 2.84 44.6508
## 6 3.26 44.2339
## 7 4.01 44.8674
## 8 3.87 45.0383
## 9 4.00 45.0604
## 10 3.82 44.3016
## 11 3.50 43.1883
## 12 3.32 44.7871
## 13 4.05 42.7412
## 14 4.05 42.3778
## 15 3.73 43.5677
## 16 3.51 43.4415
## 17 3.15 43.7534
## 18 3.28 43.0694
## 19 3.79 42.9629
## 20 3.83 43.9863
## 21 3.76 43.0238
## 22 3.77 41.2666
## 23 3.35 40.8568
## 24 3.11 42.8202
## 25 4.12 42.1822
## 26 3.89 41.2208
## 27 3.61 41.8964
## 28 3.48 40.1531
## 29 3.29 38.9120
## 30 3.37 37.6903
## 31 4.13 36.7035
## 32 4.06 37.2616
## 33 4.14 36.6558
## 34 4.17 34.2078
## 35 4.32 34.9500
## 36 4.02 34.9987
## 37 5.01 34.4084
## 38 5.24 33.4023
## 39 4.66 33.4728
## 40 5.06 34.6003
## 41 5.23 33.1933
## 42 4.98 34.2256
## 43 5.82 36.0502
## 44 6.15 34.5306
## 45 6.42 34.4993
## 46 5.67 32.6096
## 47 5.11 33.1707
## 48 4.73 33.9865
## 49 5.76 34.8020
## 50 5.28 34.2586
## 51 4.74 34.6691
## 52 5.35 35.0361
## 53 5.00 35.5938
## 54 4.92 36.7799
## 55 5.59 36.9279
## 56 5.42 37.2006
## 57 5.66 38.3303
## 58 5.48 37.4086
## 59 5.17 37.1774
## 60 4.94 38.1767
## 61 5.34 38.4624
## 62 5.34 38.4413
## 63 4.64 38.3233
## 64 5.13 37.6265
## 65 5.18 37.3597
## 66 5.40 38.7674
## 67 5.48 39.7537
## 68 5.71 38.9023
## 69 5.43 38.4823
## 70 4.99 37.7094
## 71 4.96 37.4238
## 72 4.51 37.7149
## 73 4.88 39.3604
## 74 5.28 38.9804
## 75 4.52 38.8750
## 76 4.86 40.2245
## 77 4.67 39.7323
## 78 4.75 39.7133
## 79 4.99 41.1478
## 80 5.33 40.7832
## 81 4.91 39.3550
## 82 5.03 39.6293
## 83 5.05 39.1214
## 84 4.40 41.1395
## 85 5.41 41.6134
## 86 4.75 39.6882
## 87 4.48 39.9339
## 88 4.96 39.8361
## 89 4.91 39.4471
## 90 5.00 38.7706
## 91 5.13 40.6562
## 92 5.18 40.5308
## 93 5.31 39.1825
## 94 5.01 38.0775
## 95 4.48 36.9465
## 96 4.27 37.3707
## 97 5.07 35.5508
## 98 4.66 35.7346
## 99 4.80 37.1351
## 100 4.85 37.6101
## 101 4.94 37.7513
## 102 4.82 37.9049
## 103 5.47 37.5518
## 104 5.19 37.4502
## 105 5.09 38.2199
## 106 4.78 37.6935
## 107 4.53 38.4760
## 108 3.76 38.6914
## 109 4.51 38.0625
## 110 4.33 37.4911
## 111 3.86 38.5052
## 112 4.31 37.8429
## 113 4.45 38.0317
## 114 4.41 39.1119
## 115 4.72 38.1319
## 116 4.68 37.3836
## 117 4.50 37.4490
## 118 4.55 37.8131
## 119 3.96 38.1829
## 120 3.96 38.3685
## 121 4.26 38.1815
## 122 4.14 36.7321
## 123 3.75 36.8144
## 124 3.80 36.7139
## 125 4.01 37.4848
## 126 3.92 38.3491
## 127 4.00 36.5060
## 128 3.98 35.6554
## 129 4.12 34.7550
## 130 3.67 35.0319
## 131 3.50 34.8752
## 132 3.38 35.4784
## 133 3.60 28.6679
## 134 3.34 31.5156
## 135 3.19 33.7951
## 136 3.47 34.9345
## 137 3.55 35.8733
## 138 3.29 36.0104
## 139 3.42 36.4886
## 140 3.52 36.5055
## 141 3.59 36.7879
## 142 3.51 36.4370
## 143 3.41 36.7168
## 144 3.15 36.3155
## 145 3.36 34.8018
## 146 3.17 34.1893
## 147 2.94 34.3367
## 148 3.39 35.6116
## 149 3.22 36.6479
## 150 3.37 37.1483
## 151 3.47 43.3411
## 152 3.46 43.0057
## 153 3.58 42.1327
## 154 3.27 42.5330
## 155 3.25 41.6750
## 156 3.36 44.8654
## 157 3.56 45.9299
## 158 3.29 47.8261
## 159 3.22 46.3411
## 160 3.50 45.4850
## 161 3.50 44.3235
## 162 3.57 43.6658
## 163 3.74 43.3177
## 164 3.71 43.8192
## 165 3.78 45.2995
## 166 3.69 44.0597
## 167 3.42 43.8407
## 168 2.91 43.7574
## 169 3.78 44.1205
## 170 3.53 43.3299
## 171 2.91 42.0593
## 172 4.69 32.2235
## 173 4.19 31.0682
## 174 5.49 31.9572
## 175 5.35 34.4173
## 176 5.26 35.0648
## 177 5.13 36.2820
## 178 4.71 37.8912
## 179 4.35 37.0767
## 180 3.79 38.7487
## 181 4.70 39.2114
## 182 4.40 38.6401
## 183 3.87 40.5816
## 184 4.65 42.5091
## 185 3.99 42.4227
## 186 4.02 44.3477
## 187 4.38 44.2934
## 188 4.33 42.4746
## 189 4.18 43.3421
## 190 3.95 43.8431
## 191 3.66 45.9354
## 192 3.51 44.8964
## 193 3.71 43.5909
## 194 3.74 42.9401
## 195 2.97 43.5603
## 196 3.03 44.3017
## 197 3.27 43.7823
## 198 3.35 43.2086
## 199 3.43 41.2699
## 200 3.53 40.2979
corrplot(cor(bd_prediccion2), type="upper",order="hclust",addcoef.col="black")
## Warning in text.default(pos.xlabel[, 1], pos.xlabel[, 2], newcolnames, srt =
## tl.srt, : "addcoef.col" is not a graphical parameter
## Warning in text.default(pos.ylabel[, 1], pos.ylabel[, 2], newrownames, col =
## tl.col, : "addcoef.col" is not a graphical parameter
## Warning in title(title, ...): "addcoef.col" is not a graphical parameter
summary(bd_prediccion2)
## Año Mes Venta Exportación
## Min. :2006 Min. : 1.00 Min. : 34927 Min. : 15139
## 1st Qu.:2010 1st Qu.: 3.00 1st Qu.: 78543 1st Qu.:153219
## Median :2014 Median : 6.00 Median : 88580 Median :209160
## Mean :2014 Mean : 6.42 Mean : 94178 Mean :201664
## 3rd Qu.:2018 3rd Qu.: 9.00 3rd Qu.:110134 3rd Qu.:243900
## Max. :2022 Max. :12.00 Max. :192741 Max. :327454
## Tipo.de.cambio Inflación porcentaje_ocu porcentaje_desocu
## Min. :10.09 Min. :-0.250 Min. :93.58 Min. :2.840
## 1st Qu.:12.66 1st Qu.: 0.815 1st Qu.:95.06 1st Qu.:3.527
## Median :13.56 Median : 1.480 Median :95.88 Median :4.125
## Mean :15.48 Mean : 1.951 Mean :95.76 Mean :4.244
## 3rd Qu.:19.10 3rd Qu.: 2.895 3rd Qu.:96.47 3rd Qu.:4.940
## Max. :24.24 Max. : 7.360 Max. :97.16 Max. :6.420
## conf_consumidor
## Min. :28.67
## 1st Qu.:36.69
## Median :38.47
## Mean :39.15
## 3rd Qu.:42.59
## Max. :47.83
modelo_regresion1 <- lm(Exportación~Año+Mes+Tipo.de.cambio+Inflación+porcentaje_ocu+porcentaje_desocu+conf_consumidor,data=bd_prediccion2)
summary(modelo_regresion1)
##
## Call:
## lm(formula = Exportación ~ Año + Mes + Tipo.de.cambio + Inflación +
## porcentaje_ocu + porcentaje_desocu + conf_consumidor, data = bd_prediccion2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -223340 -17123 3169 21264 87133
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -3.913e+07 3.447e+06 -11.352 < 2e-16 ***
## Año 1.835e+04 1.645e+03 11.151 < 2e-16 ***
## Mes 6.334e+03 1.054e+03 6.007 9.25e-09 ***
## Tipo.de.cambio -1.280e+04 2.212e+03 -5.785 2.89e-08 ***
## Inflación -1.022e+04 2.390e+03 -4.275 3.01e-05 ***
## porcentaje_ocu 2.763e+04 4.394e+03 6.289 2.09e-09 ***
## porcentaje_desocu NA NA NA NA
## conf_consumidor -2.142e+03 8.735e+02 -2.452 0.0151 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 36390 on 193 degrees of freedom
## Multiple R-squared: 0.6723, Adjusted R-squared: 0.6621
## F-statistic: 65.99 on 6 and 193 DF, p-value: < 2.2e-16
effect_plot(modelo_regresion1,pred=Tipo.de.cambio,interval=TRUE)
## Warning in predict.lm(model, newdata = pm, se.fit = interval, interval =
## int.type[1], : prediction from a rank-deficient fit may be misleading
modelo_regresion2 <- lm(Venta~Año+Mes+Tipo.de.cambio+Inflación+porcentaje_ocu+porcentaje_desocu+conf_consumidor,data=bd_prediccion2)
summary(modelo_regresion2)
##
## Call:
## lm(formula = Venta ~ Año + Mes + Tipo.de.cambio + Inflación +
## porcentaje_ocu + porcentaje_desocu + conf_consumidor, data = bd_prediccion2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -66653 -9529 -696 9350 64461
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -7208005.1 1525100.0 -4.726 4.40e-06 ***
## Año 2561.8 727.9 3.519 0.000539 ***
## Mes 3468.4 466.5 7.434 3.34e-12 ***
## Tipo.de.cambio -2373.5 978.9 -2.425 0.016241 *
## Inflación -3991.3 1057.4 -3.775 0.000213 ***
## porcentaje_ocu 23358.2 1943.9 12.016 < 2e-16 ***
## porcentaje_desocu NA NA NA NA
## conf_consumidor -1822.0 386.5 -4.714 4.63e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 16100 on 193 degrees of freedom
## Multiple R-squared: 0.5586, Adjusted R-squared: 0.5449
## F-statistic: 40.71 on 6 and 193 DF, p-value: < 2.2e-16
effect_plot(modelo_regresion2,pred=porcentaje_ocu,interval=TRUE)
## Warning in predict.lm(model, newdata = pm, se.fit = interval, interval =
## int.type[1], : prediction from a rank-deficient fit may be misleading