Created
September 16, 2019 11:42
-
-
Save chainsawriot/8c6111d316701caff2f06bd4f8625845 to your computer and use it in GitHub Desktop.
bimodal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(tidyverse) | |
require(tidyr) | |
require(moments) | |
nrespondants <- c(223, 41, 63, 86, 64, 251, 82, 73, 74, 17, 64, 168, 43, 47, 64, 35, 135, 28, 15, 43, 10, 43, 366, 45, 73, 50, 26, 121, 25, 38, 44, 5, 46, 260, 36, 54, 49, 31, 63, 26, 30, 29, 3, 44) | |
score <- rep(0:10, 4) | |
wave <- sort(rep(1:4, 11)) | |
tibble(wave = wave, score = score, nrespondants = nrespondants) %>% uncount(nrespondants) %>% group_by(wave) %>% summarise(k = kurtosis(score), y = skewness(score), beta = (y^2 + 1) /k) %>% ggplot(aes(x = wave, y = beta)) + geom_point(size = 3) + ylim(0, 0.7) | |
ggsave("polpol.jpg") | |
npolice <- c(68, 24, 45, 89, 50, 264, 110, 117, 126, 40, 107, 143, 23, 42, 61, 27, 119, 21, 49, 49, 116, 79, 360, 46, 66, 50, 30, 82, 19, 41, 45, 22, 76, 301, 35, 44, 31, 18, 40, 8, 17, 44, 16, 63) | |
tibble(wave = wave, score = score, npolice = npolice) %>% uncount(npolice) %>% group_by(wave) %>% summarise(k = kurtosis(score), y = skewness(score), beta = (y^2 + 1) /k) %>% ggplot(aes(x = wave, y = beta)) + geom_point(size = 3) + ylim(0, 1) | |
ggsave("policepolpol.jpg") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment