Este panel muestra la relación entre μ (expectativas), σ (desviación) y contribuciones a partir del experimento.
Los gráficos a continuación fueron generados en R usando
plotly, ggplot2, y rmarkdown.
## Warning: unable to access index for repository https://cran.rstudio.com/src/contrib:
## no fue posible abrir la URL 'https://cran.rstudio.com/src/contrib/PACKAGES'
## Warning: package 'paletteer' is not available for this version of R
##
## A version of this package for your version of R might be available elsewhere,
## see the ideas at
## https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
## Warning: unable to access index for repository https://cran.rstudio.com/bin/windows/contrib/4.4:
## no fue posible abrir la URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/PACKAGES'
## Cargando paquete requerido: ggplot2
##
## Adjuntando el paquete: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
##
## Adjuntando el paquete: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
# Definir paleta colores
# Obtener 6 colores de la paleta cartography::blue.pal
blue_cartography <- as.character(paletteer_dynamic("cartography::blue.pal", 20)[seq(1, 20, length.out = 6)])
# Para plotly: armar escala personalizada
colorscale_cartography <- lapply(seq_along(blue_cartography), function(i) {
list((i - 1) / (length(blue_cartography) - 1), blue_cartography[[i]])
})
# Para ggplot: asignar colores a valores discretos
blue_cartography_named <- setNames(blue_cartography, as.character(0:5))setwd("C:/Users/dajorrat/Dropbox/Universidad Loyola Andalucía/Experimento Cabrales MPaz PBG/Outputs") # Ajustar si es necesario
data <- read.csv("data_bruta_3d_all.csv", sep = ",")
data %>%
summarise(across(c(expcont, cont_pgg, sd), list(
mean = ~mean(.x, na.rm = TRUE),
sd = ~sd(.x, na.rm = TRUE),
min = ~min(.x, na.rm = TRUE),
max = ~max(.x, na.rm = TRUE),
n = ~sum(!is.na(.x))
)))## expcont_mean expcont_sd expcont_min expcont_max expcont_n cont_pgg_mean
## 1 2.242833 1.201923 0 5 1500 2.721333
## cont_pgg_sd cont_pgg_min cont_pgg_max cont_pgg_n sd_mean sd_sd sd_min
## 1 1.386949 0 5 1500 0.3907576 0.4923561 0
## sd_max sd_n
## 1 2.886751 1500
#Figure 1. Average contributions by ambiguity condition
#Figure 2. Average contributions and SEM according to terciles of σ
#Figure 3. Average contributions and SEM according to terciles of μ
#Figure 4. Average contributions by extremes terciles of μ and σ
Para entender mejor las interacciones, se procede a realizar un gráfico 3D para ver cómo cambia las contribuciones cuando cambian μ y σ. Hay tres alternativas
#Alternativa 1: datos brutos.
#Alternativa 2: Mapa de calor por categorías reales (sin interpolar)
#Alternativa 3: linear prediction of marginals effects
#Alternativa 4: logit model of high contribution (=1 if contribution > p50 of the contributions) and the marginal effects
Podés descargar el gráfico haciendo clic derecho sobre él y eligiendo “Guardar imagen como…” o usar las opciones del botón superior derecho del gráfico interactivo.