-
Notifications
You must be signed in to change notification settings - Fork 0
/
Proyecciones RMNA 202526.qmd
694 lines (533 loc) · 23.1 KB
/
Proyecciones RMNA 202526.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
---
title: "Proyecciones RMNA 2025-26 - GTRM Perú"
format: html-pdf
editor: visual
mainfont: Dosis
---
```{r setup, include = FALSE}
library(tidyverse)
library(stringr)
library(unhcrthemes)
library(scales)
# Source: Movements Report
data <- read.csv("https://raw.githubusercontent.com/IM-Peru/JNA_2024/main/Movement_Report.csv")
data$Mes <- gsub(" ", "", data$Mes)
names(data) <- gsub("\\.", "", names(data))
# Two starting dates for two scenarios
fecha_1 <- "2023-12-31"
fecha_2 <- "2023-04-01"
# Stock for 2024
stock_2024 <- 1542004
data_1 <- data |>
filter(Nacionalidad == "VEN") |>
mutate(Fecha = paste(Mes, "-01", sep="")) |>
mutate(Fecha = as.Date(Fecha)) |>
filter(Fecha >= fecha_1) |>
select(Mes:"IrregularesTOTALSalidas") |>
group_by(Nacionalidad) |>
summarize(across(contains("egulare"), list(mean = ~mean(., na.rm = TRUE),
min = ~min(., na.rm = TRUE),
max = ~max(., na.rm = TRUE),
median = ~median(., na.rm = TRUE)), .names = "{.col}_{.fn}")) |>
pivot_longer(-1, names_to = c("Tipo", "Calc"), names_sep = "_", values_to = "Tot") |>
mutate(Tot = round(Tot, 0)) |>
ungroup() |>
filter(!grepl('DTM', Tipo)) |>
pivot_wider(names_from = Calc, values_from = Tot) |>
mutate(Flujo = if_else(str_detect(Tipo, "Regulares"), "Regulares", "Irregulares")) |>
mutate(Punto = if_else(str_detect(Tipo, "Tumbes"), "Tumbes",
if_else(str_detect(Tipo, "Tacna"), "Tacna",
if_else(str_detect(Tipo, "Puno"), "Puno",
if_else(str_detect(Tipo, "Madre"), "MdD",
if_else(str_detect(Tipo, "Aeropuerto"), "Aeropuerto",
if_else(str_detect(Tipo, "otros"), "Otros", "Total"))))))) |>
mutate(Direct = if_else(str_detect(Tipo, "Entradas"), "Entradas", "Salidas")) |>
select(Nacionalidad, Punto, Flujo, Direct, mean, min, max, median)
data_1 <- lapply(data_1, function(x) {
x[is.infinite(x)] <- NA
x[is.nan(x)] <- NA
return(x)
})
data_1 <- as.data.frame(data_1)
data_1 <- data_1[complete.cases(data_1), ]
# Cálculo escenarios desde Fecha 2
data_2 <- data |>
mutate(Fecha = paste(Mes, "-01", sep="")) |>
mutate(Fecha = as.Date(Fecha)) |>
filter(Fecha >= fecha_2) |>
select(Mes:"IrregularesTOTALSalidas") |>
group_by(Nacionalidad) |>
summarize(across(contains("egulare"), list(mean = ~mean(., na.rm = TRUE),
min = ~min(., na.rm = TRUE),
max = ~max(., na.rm = TRUE),
median = ~median(., na.rm = TRUE)), .names = "{.col}_{.fn}")) |>
pivot_longer(-1, names_to = c("Tipo", "Calc"), names_sep = "_", values_to = "Tot") |>
mutate(Tot = round(Tot, 0)) |>
ungroup() |>
filter(!grepl('DTM', Tipo)) |>
pivot_wider(names_from = Calc, values_from = Tot) |>
mutate(Flujo = if_else(str_detect(Tipo, "Regulares"), "Regulares", "Irregulares")) |>
mutate(Punto = if_else(str_detect(Tipo, "Tumbes"), "Tumbes",
if_else(str_detect(Tipo, "Tacna"), "Tacna",
if_else(str_detect(Tipo, "Puno"), "Puno",
if_else(str_detect(Tipo, "Madre"), "MdD",
if_else(str_detect(Tipo, "Aeropuerto"), "Aeropuerto",
if_else(str_detect(Tipo, "otros"), "Otros", "Total"))))))) |>
mutate(Direct = if_else(str_detect(Tipo, "Entradas"), "Entradas", "Salidas")) |>
select(Nacionalidad, Punto, Flujo, Direct, mean, min, max, median) |>
filter(Nacionalidad == "VEN")
data_2 <- lapply(data_2, function(x) {
x[is.infinite(x)] <- NA
x[is.nan(x)] <- NA
return(x)
})
data_2 <- as.data.frame(data_2)
data_2 <- data_2[complete.cases(data_2), ]
```
## Saldo Escenario 1: Flujos 2024
Fecha de referencia: desde `r fecha_1` a 2024-04-31
::: columns
::: {.column width="60%"}
```{r, echo = FALSE, warning = FALSE}
saldo <- function(direction, var){
result = data_1 |>
filter(Punto != "Total") |>
filter(Direct == direction) |>
select(Direct, {{ var }}) |>
group_by(Direct) |>
summarize(value = sum({{ var }}, na.rm = TRUE))
return(result$value)
}
entries_mean_1 <- saldo("Entradas", mean) / 30
entries_min_1 <- saldo("Entradas", min) / 30
entries_max_1 <- saldo("Entradas", max) / 30
entries_max_1 <- saldo("Entradas", max) / 30
entries_median_1 <- saldo("Entradas", median) / 30
exits_mean_1 <- saldo("Salidas", mean) / 30
exits_min_1 <- saldo("Salidas", min) / 30
exits_max_1 <- saldo("Salidas", max) / 30
exits_median_1 <- saldo("Salidas", median) / 30
# entries <- list(mean_1 = entries_mean_1, min_1 = entries_min_1, max_1 = entries_max_1)
# exits <- list(mean_1 = exits_mean_1, min_1 = exits_min_1, max_1 = exits_max_1)
result_matrix <- matrix(nrow = 4, ncol = 4)
rownames(result_matrix) <- c("entries_mean_1", "entries_min_1", "entries_max_1", "entries_median_1")
colnames(result_matrix) <- c("exits_mean_1", "exits_min_1", "exits_max_1", "exits_median_1")
result_matrix["entries_mean_1", "exits_mean_1"] <- entries_mean_1 - exits_mean_1
result_matrix["entries_mean_1", "exits_min_1"] <- entries_mean_1 - exits_min_1
result_matrix["entries_mean_1", "exits_max_1"] <- entries_mean_1 - exits_max_1
result_matrix["entries_mean_1", "exits_median_1"] <- entries_mean_1 - exits_median_1
result_matrix["entries_min_1", "exits_mean_1"] <- entries_min_1 - exits_mean_1
result_matrix["entries_min_1", "exits_min_1"] <- entries_min_1 - exits_min_1
result_matrix["entries_min_1", "exits_max_1"] <- entries_min_1 - exits_max_1
result_matrix["entries_min_1", "exits_median_1"] <- entries_min_1 - exits_median_1
result_matrix["entries_max_1", "exits_mean_1"] <- entries_max_1 - exits_mean_1
result_matrix["entries_max_1", "exits_min_1"] <- entries_max_1 - exits_min_1
result_matrix["entries_max_1", "exits_max_1"] <- entries_max_1 - exits_max_1
result_matrix["entries_max_1", "exits_median_1"] <- entries_max_1 - exits_median_1
result_matrix["entries_median_1", "exits_mean_1"] <- entries_median_1 - exits_mean_1
result_matrix["entries_median_1", "exits_min_1"] <- entries_median_1 - exits_min_1
result_matrix["entries_median_1", "exits_max_1"] <- entries_median_1 - exits_max_1
result_matrix["entries_median_1", "exits_median_1"] <- entries_median_1 - exits_median_1
saldo_diario <- as.data.frame(as.table(result_matrix)) |>
mutate(across(Freq,\(x) round(x, 0))) |>
rename(Entries = Var1) |>
rename(Exits = Var2)|>
mutate(Entries = if_else(Entries == "entries_max_1", "Máximo Ingresos",
if_else(Entries == "entries_min_1", "Mínimo Ingresos",
if_else(Entries == "entries_mean_1", "Promedio Ingresos",
"Ingresos Medianos")))) |>
mutate(Exits = if_else(Exits == "exits_max_1", "Máximo Salidas",
if_else(Exits == "exits_min_1", "Mínimo Salidas",
if_else(Exits == "exits_mean_1", "Promedio Salidas",
"Salidas Medianas"))))
#print(result_matrix)
ggplot(
saldo_diario |>
mutate(Entries = fct_relevel(Entries, c("Máximo Ingresos", "Mínimo Ingresos", "Ingresos Medianos", "Promedio Ingresos")),
Exits = fct_relevel(Exits, c("Promedio Salidas", "Salidas Medianas", "Mínimo Salidas", "Máximo Salidas"))),
aes(
x = Exits,
y = Entries
)
) +
geom_tile(aes(
fill = Freq
),
color = "white",
lwd = .5,
linetype = 1
) +
labs(
title = "Saldo diario 2025-26"
) +
scale_x_discrete(
labels = scales::label_wrap(3),
position = "top"
) +
scale_y_discrete(
labels = scales::label_wrap(3)
) +
scale_fill_stepsn(
colors = c("#75B5E4", "#0088CC", "#00649F", "#004469"),
n.break = 3,
name = "Saldo diario"
) +
coord_fixed() +
geom_text(aes(label = Freq), colour = "white", size = 3
) +
theme_unhcr(
font_size = 13,
grid = FALSE,
axis = FALSE,
axis_title = FALSE,
legend_title = TRUE
)
```
:::
::: {.column width="20%"}
\
**Rangos:** \
\
**`r round(sum(entries_max_1 - exits_min_1), 0)`** <br/> Saldo máximo <br/> (`r format(round(sum(entries_max_1 - exits_min_1), 0)*365, big.mark = ",")` anual)
\
**`r round(sum(entries_min_1 - exits_max_1), 0)`** <br/> Saldo mínimo <br/> (`r format(round(sum(entries_min_1 - exits_max_1), 0)*365, big.mark = ",")` anual)
\
:::
::: {.column width="20%"}
\
**Status quo:** \
\
**`r round(sum(entries_mean_1 - exits_mean_1), 0)`** <br/> Saldo promedio <br/> (`r format(round(sum(entries_mean_1 - exits_mean_1), 0)*365, big.mark = ",")` anual)
\
**`r round(sum(entries_median_1 - exits_median_1), 0)`** <br/> Saldo mediano <br/> (`r format(round(sum(entries_median_1 - exits_median_1), 0)*365, big.mark = ",")` anual)
:::
:::
La tabla de calor muestra las posibles combinaciones de los saldos según los flujos observados en los meses de 2024, calculados utilizando los valores máximos, mínimos, promedio y mediano. Por ejemplo, la primera celda arriba la izquierda enseña el saldo diario restando el promedio de salidas al promedio de entradas durante el periodo señalado.
En este sentido se consideran que los rangos de proyecciones se pueden categorizar entre (1) un **saldo máximo**, donde se plantea un máximo de ingresos y un mínimo de salidas al país y (2) un **saldo mínimo**, en el cual se considera un mínimo de ingresos y un máximo de salidas al país . Entre ellos, se puede estimar un **resultado status quo**, representado por las entradas y salidas promedio o medianas.
```{r, echo = FALSE, warning = FALSE, fig.height = 4.5, fig.width = 8}
year <- c(2024, 2025, 2026)
mean_1 <- c(stock_2024, stock_2024 + (sum(entries_mean_1 - exits_mean_1) * 365), stock_2024 + ((sum(entries_mean_1 - exits_mean_1) * 365))*2)
min_1 <- c(stock_2024, stock_2024 + (sum(entries_min_1 - exits_max_1) * 365), stock_2024 + ((sum(entries_min_1 - exits_max_1) * 365))*2)
max_1 <- c(stock_2024, stock_2024 + (sum(entries_max_1 - exits_min_1) * 365), stock_2024 + ((sum(entries_max_1 - exits_min_1) * 365))*2)
median_1 <- c(stock_2024, stock_2024 + (sum(entries_median_1 - exits_median_1) * 365), stock_2024 + ((sum(entries_median_1 - exits_median_1) * 365))*2)
stock_proj_1 <- data.frame(year, mean_1, min_1, max_1, median_1) |>
pivot_longer(-1, names_to = "type", values_to = "stock") |>
mutate(type = str_sub(type, end = -3)) |>
mutate(year = as.character(year)) |>
mutate(type = if_else(type == "mean", "Promedio",
if_else(type == "min", "Mínimo",
if_else(type == "max", "Máximo",
"Mediana"))))
# Plot
ggplot(stock_proj_1 |>
mutate(type = fct_relevel(type, c("Máximo", "Mínimo", "Promedio", "Mediana")),
year = fct_relevel(year, c("2026", "2025", "2024")))) +
geom_col(aes(
x = type,
y = stock,
fill = fct_rev(year)
),
position = position_dodge(width = 0.7),
width = 0.6
) +
geom_text(aes(
x = type,
y = stock,
group = fct_rev(year),
label = round(stock / 1e6, 3)
),
position = position_dodge(width = 0.7),
vjust = -1,
size = 8 / .pt
) +
scale_fill_unhcr_d(
palette = "pal_unhcr",
nmax = 3,
order = c(3, 2, 1)
) +
labs(
title = "Proyecciones 2025-26",
subtitle = "En millones de personas"
) +
# scale_x_continuous(breaks = pretty_breaks(n = 4)) +
# scale_y_continuous(expand = expansion(c(0, 0.1))) +
theme_unhcr(
grid = FALSE,
axis = "x",
axis_title = FALSE,
axis_text = "x"
) +
guides(fill = guide_legend(nrow = 1, byrow = TRUE)) +
ylim(0, max(stock_proj_1$stock)*1.1)
```
## Saldo Escenario 2: Últimos 12 meses
Fecha de referencia: desde `r fecha_2` a 2024-04-31
::: columns
::: {.column width="60%"}
```{r, echo = FALSE, warning = FALSE}
saldo <- function(direction, var){
result = data_2 |>
filter(Punto != "Total") |>
filter(Direct == direction) |>
select(Direct, {{ var }}) |>
group_by(Direct) |>
summarize(value = sum({{ var }}, na.rm = TRUE))
return(result$value)
}
entries_mean_2 <- saldo("Entradas", mean) / 30
entries_min_2 <- saldo("Entradas", min) / 30
entries_max_2 <- saldo("Entradas", max) / 30
entries_median_2 <- saldo("Entradas", median) / 30
exits_mean_2 <- saldo("Salidas", mean) / 30
exits_min_2 <- saldo("Salidas", min) / 30
exits_max_2 <- saldo("Salidas", max) / 30
exits_median_2 <- saldo("Salidas", median) / 30
# entries <- list(mean_2 = entries_mean_2, min_2 = entries_min_2, max_2 = entries_max_2)
# exits <- list(mean_2 = exits_mean_2, min_2 = exits_min_2, max_2 = exits_max_2)
result_matrix <- matrix(nrow = 4, ncol = 4)
rownames(result_matrix) <- c("entries_mean_2", "entries_min_2", "entries_max_2", "entries_median_2")
colnames(result_matrix) <- c("exits_mean_2", "exits_min_2", "exits_max_2", "exits_median_2")
result_matrix["entries_mean_2", "exits_mean_2"] <- entries_mean_2 - exits_mean_2
result_matrix["entries_mean_2", "exits_min_2"] <- entries_mean_2 - exits_min_2
result_matrix["entries_mean_2", "exits_max_2"] <- entries_mean_2 - exits_max_2
result_matrix["entries_mean_2", "exits_median_2"] <- entries_mean_2 - exits_median_2
result_matrix["entries_min_2", "exits_mean_2"] <- entries_min_2 - exits_mean_2
result_matrix["entries_min_2", "exits_min_2"] <- entries_min_2 - exits_min_2
result_matrix["entries_min_2", "exits_max_2"] <- entries_min_2 - exits_max_2
result_matrix["entries_min_2", "exits_median_2"] <- entries_min_2 - exits_median_2
result_matrix["entries_max_2", "exits_mean_2"] <- entries_max_2 - exits_mean_2
result_matrix["entries_max_2", "exits_min_2"] <- entries_max_2 - exits_min_2
result_matrix["entries_max_2", "exits_max_2"] <- entries_max_2 - exits_max_2
result_matrix["entries_max_2", "exits_median_2"] <- entries_max_2 - exits_median_2
result_matrix["entries_median_2", "exits_mean_2"] <- entries_median_2 - exits_mean_2
result_matrix["entries_median_2", "exits_min_2"] <- entries_median_2 - exits_min_2
result_matrix["entries_median_2", "exits_max_2"] <- entries_median_2 - exits_max_2
result_matrix["entries_median_2", "exits_median_2"] <- entries_median_2 - exits_median_2
saldo_diario <- as.data.frame(as.table(result_matrix)) |>
mutate(across(Freq,\(x) round(x, 0))) |>
rename(Entries = Var1) |>
rename(Exits = Var2)|>
mutate(Entries = if_else(Entries == "entries_max_2", "Máximo Ingresos",
if_else(Entries == "entries_min_2", "Mínimo Ingresos",
if_else(Entries == "entries_mean_2", "Promedio Ingresos",
"Ingresos Medianos")))) |>
mutate(Exits = if_else(Exits == "exits_max_2", "Máximo Salidas",
if_else(Exits == "exits_min_2", "Mínimo Salidas",
if_else(Exits == "exits_mean_2", "Promedio Salidas",
"Salidas Medianas"))))
#print(result_matrix)
ggplot(
saldo_diario |>
mutate(Entries = fct_relevel(Entries, c("Máximo Ingresos", "Mínimo Ingresos", "Ingresos Medianos", "Promedio Ingresos")),
Exits = fct_relevel(Exits, c("Promedio Salidas", "Mínimo Salidas", "Máximo Salidas", "Salidas Medianas"))),
aes(
x = Exits,
y = Entries
)
) +
geom_tile(aes(
fill = Freq
),
color = "white",
lwd = .5,
linetype = 1
) +
labs(
title = "Saldo diario 2025-26"
) +
scale_x_discrete(
labels = scales::label_wrap(3),
position = "top"
) +
scale_y_discrete(
labels = scales::label_wrap(3)
) +
scale_fill_stepsn(
colors = c("#75B5E4", "#0088CC", "#00649F", "#004469"),
n.break = 3,
name = "Saldo diario"
) +
coord_fixed() +
geom_text(aes(label = Freq), colour = "white", size = 3
) +
theme_unhcr(
font_size = 13,
grid = FALSE,
axis = FALSE,
axis_title = FALSE,
legend_title = TRUE
)
```
:::
::: {.column width="20%"}
\
**Rangos:** \
\
**`r round(sum(entries_max_2 - exits_min_2), 0)`** <br/> Saldo máximo <br/> (`r format(round(sum(entries_max_2 - exits_min_2), 0)*365, big.mark = ",")` anual)
\
**`r round(sum(entries_min_2 - exits_max_2), 0)`** <br/> Saldo mínimo <br/> (`r format(round(sum(entries_min_2 - exits_max_2), 0)*365, big.mark = ",")` anual)
\
:::
::: {.column width="20%"}
\
**Status quo:** \
\
**`r round(sum(entries_mean_2 - exits_mean_2), 0)`** <br/> Saldo promedio <br/> (`r format(round(sum(entries_mean_2 - exits_mean_2), 0)*365, big.mark = ",")` anual)
\
**`r round(sum(entries_median_2 - exits_median_2), 0)`** <br/> Saldo mediano <br/> (`r format(round(sum(entries_median_2 - exits_median_2), 0)*365, big.mark = ",")` anual)
:::
:::
La tabla de calor muestra las posibles combinaciones de los saldos según los flujos observados en los meses de 2024, calculados utilizando los valores máximos, mínimos, promedio y mediano. Por ejemplo, la primera celda arriba la izquierda enseña el saldo diario restando el promedio de salidas al promedio de entradas durante el periodo señalado.
En este sentido se consideran que los rangos de proyecciones se pueden categorizar entre (1) un **saldo máximo**, donde se plantea un máximo de ingresos y un mínimo de salidas al país y (2) un **saldo mínimo**, en el cual se considera un mínimo de ingresos y un máximo de salidas al país . Entre ellos, se puede estimar un **resultado status quo**, representado por las entradas y salidas promedio o medianas.
```{r, echo = FALSE, warning = FALSE, fig.height = 4.5, fig.width = 8}
year <- c(2024, 2025, 2026)
mean_2 <- c(stock_2024, stock_2024 + (sum(entries_mean_2 - exits_mean_2) * 365), stock_2024 + ((sum(entries_mean_2 - exits_mean_2) * 365))*2)
min_2 <- c(stock_2024, stock_2024 + (sum(entries_min_2 - exits_max_2) * 365), stock_2024 + ((sum(entries_min_2 - exits_max_2) * 365))*2)
max_2 <- c(stock_2024, stock_2024 + (sum(entries_max_2 - exits_min_2) * 365), stock_2024 + ((sum(entries_max_2 - exits_min_2) * 365))*2)
median_2 <- c(stock_2024, stock_2024 + (sum(entries_median_2 - exits_median_2) * 365), stock_2024 + ((sum(entries_median_2 - exits_median_2) * 365))*2)
stock_proj_2 <- data.frame(year, mean_2, min_2, max_2, median_2) |>
pivot_longer(-1, names_to = "type", values_to = "stock") |>
mutate(type = str_sub(type, end = -3)) |>
mutate(year = as.character(year)) |>
mutate(type = if_else(type == "mean", "Promedio",
if_else(type == "min", "Mínimo",
if_else(type == "max", "Máximo",
"Mediana"))))
# Plot
ggplot(stock_proj_2 |>
mutate(type = fct_relevel(type, c("Máximo", "Mínimo", "Promedio","Mediana")),
year = fct_relevel(year, c("2026", "2025", "2024")))) +
geom_col(aes(
x = type,
y = stock,
fill = fct_rev(year)
),
position = position_dodge(width = 0.7),
width = 0.6
) +
geom_text(aes(
x = type,
y = stock,
group = fct_rev(year),
label = round(stock / 1e6, 3)
),
position = position_dodge(width = 0.7),
vjust = -1,
size = 8 / .pt
) +
scale_fill_unhcr_d(
palette = "pal_unhcr",
nmax = 3,
order = c(3, 2, 1)
) +
labs(
title = "Proyecciones 2025-26",
subtitle = "En millones de personas"
) +
# scale_x_continuous(breaks = pretty_breaks(n = 4)) +
# scale_y_continuous(expand = expansion(c(0, 0.1))) +
theme_unhcr(
grid = FALSE,
axis = "x",
axis_title = FALSE,
axis_text = "x"
) +
guides(fill = guide_legend(nrow = 1, byrow = TRUE)) +
ylim(0, max(stock_proj_2$stock)*1.1)
```
<br/>
## Propuesta de Proyecciones 2025-26 - Equipo IM
Considerando estos elementos, el equipo de Manejo de Información propone las proyecciones siguientes:
::: {.column width="30%"}
<center>
**`r round(sum(entries_mean_2 - exits_mean_2), 0)`** <br/> Saldo proyectado <br/> (`r format(round(sum(entries_mean_2 - exits_mean_2), 0)*365, big.mark = ",")` anual)
</center>
:::
::: {.column width="30%"}
<center>
**`r format(round(stock_2024 + (sum(entries_mean_2 - exits_mean_2) * 365), 0), big.mark = ",")`** <br/> Stock 2025 <br/>
</center>
:::
::: {.column width="30%"}
<center>
**`r format(round(stock_2024 + ((sum(entries_mean_2 - exits_mean_2) * 365)) * 2, 0), big.mark = ",")`** <br/> Stock 2026 <br/>
</center>
:::
Esta proyección utiliza el saldo promedio de ingresos y salidas observados entre abril 2023 y abril 2024 y presupone un stock constante en 2024 de 1.54M de personas venezolanas. Los flujos bajo esta proyección serían los siguientes:
::: {.column width="49%" }
<center>
**`r format(round(sum(entries_mean_2), 0), big.mark = ",")`** <br>
Entradas diarias <br>
(`r format(round(sum(entries_mean_2), 0)*365, big.mark = ",")` anual)
</center>
:::
::: {.column width="49%" }
<center>
**`r format(round(sum(exits_mean_2), 0), big.mark = ",")`** <br>
Salidas diarias <br>
(`r format(round(sum(exits_mean_2), 0)*365, big.mark = ",")` anual)
</center>
:::
```{r, echo = FALSE, warning = FALSE, message = FALSE}
# Utilizando Promedio de Escenario 2
data_proyecciones <- data_2 |>
select(Punto, Direct, mean) |>
group_by(Punto, Direct) |>
summarize(mean = sum(mean, na.rm = TRUE)) |>
filter(Punto != "Total") |>
mutate(mean = round(mean / 30 * 365, 0)) |>
pivot_wider(names_from = Direct, values_from = mean) |>
arrange(Punto) |>
mutate(Entradas = format(Entradas, big.mark = ",")) |>
mutate(Salidas = format(Salidas, big.mark = ",")) |>
rename("Entradas anuales" = Entradas) |>
rename("Salidas anuales" = Salidas)
entries_mean_2 <- saldo("Entradas", mean) / 30
library(kableExtra)
kable(data_proyecciones, align=rep('r', 5), format = "html")
```
Aplicando esta proyección al stock de población venezolana en Perú en el tiempo, se obtendría lo siguiente:
```{r, echo = FALSE, warning = FALSE, message = FALSE, fig.height = 3.5, fig.width = 8}
stock_2016 <- 8170
stock_2017 <- 66858
stock_2018 <- 691565
stock_2019 <- 863613
stock_2020 <- 1043460
stock_2021 <- 1286464
stock_2022 <- 1493645
stock_2023 <- 1542004
stock_2024 <- 1542004
stock_2025 <- round(stock_2024 + (sum(entries_mean_2 - exits_mean_2) * 365), 0)
stock_2026 <- round(stock_2024 + ((sum(entries_mean_2 - exits_mean_2) * 365)*2), 0)
Stock <- c(stock_2016, stock_2017, stock_2018, stock_2019, stock_2020, stock_2021, stock_2022, stock_2023, stock_2024, stock_2025, stock_2026)
Stock_year <- c(2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026)
Stock <- data.frame(Stock_year, Stock) |>
mutate(Stock_year = as.character(Stock_year)) |>
select(Stock_year, Stock)
# Plot
ggplot(Stock) +
geom_col(aes(
x = Stock_year,
y = Stock
),
fill = "#00649F",
width = 0.8
) +
geom_text(aes(
x = Stock_year,
y = Stock,
label = paste(round(Stock / 1e6, 3), "M", sep = "")
),
vjust = -1, size = 8 / .pt
) +
labs(
title = "Evolución de total poblacional en el tiempo"
) +
scale_y_continuous(expand = expansion(c(0, 0.1))) +
theme_unhcr(
grid = FALSE,
axis = "x",
axis_title = FALSE,
axis_text = "x"
)
```