Skip to content

Instantly share code, notes, and snippets.

@alexpghayes
Created May 19, 2024 02:03
Show Gist options
  • Save alexpghayes/040d384c1b23209009c372c835469216 to your computer and use it in GitHub Desktop.
Save alexpghayes/040d384c1b23209009c372c835469216 to your computer and use it in GitHub Desktop.
library(tidyverse)
library(osfr)

meta <- osf_retrieve_file("5a9hb") |>
  osf_download(conflicts = "overwrite")

data <- meta$local_path |> 
  read_csv() |> 
  select(SAI_winsorized_IQ, Raven_IQ, SAIQ_IQ_dif) |> 
  rename(
    SAIQ = SAI_winsorized_IQ,
    IQ = Raven_IQ,
    overconfidence = SAIQ_IQ_dif
  )
#> Rows: 929 Columns: 56
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr  (2): study, ResearchAsisitant
#> dbl (54): ID, Raven1, Raven2, Raven3, Raven4, Raven5, Raven6, Raven7, Raven8...
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

data |> 
  ggplot(aes(IQ, overconfidence)) +
  geom_point(alpha = 0.5) +
  geom_smooth() +
  geom_hline(yintercept = 0, linetype = "dashed", color = "darkgrey") +
  labs(
    y = "Overconfidence (SAIQ - IQ)",
    x = "IQ"
  ) +
  theme_minimal(16)
#> `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

Created on 2024-05-18 with reprex v2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment