Open NeuroShepherd opened 2 months ago
library(dplyr)
library(magrittr)
library(purrr)
library(ggplot2)
250
58
practice_results <- c(rep(1, 250), rep(0, 58))
# sum(sample(practice_results, 33, replace = FALSE))
simulation_results <- replicate(
10000,
sum(sample(practice_results, 33, replace = FALSE))
)
hist(simulation_results, breaks = 20, col = "skyblue", border = "black")
sum(practice_results < 17)/10000
?lower.tri
(m2 <- matrix(1:20, 4, 5))
lower.tri(m2)
m2[lower.tri(m2)] <- NA
results_mat <- matrix(0, 308, 308)
results_mat[lower.tri(results_mat)] <- 1
results_mat <- t(results_mat)
simulation_all_levels <- results_mat %>%
as.data.frame() %>%
tibble::tibble() %>%
purrr::map(
~replicate(
10000,
sum(sample(.x, 33, replace = FALSE))
)
)
simulation_all_levels %>%
map_dbl(
~sum(.x >= 17)/10000
) %>%
tibble::tibble(passig_probability = .) %>%
mutate(number_correct_practice = row_number()) %>%
ggplot(aes(number_correct_practice, passig_probability)) +
geom_point() +
geom_line()