File:Condorcet’s jury theorem graph.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 375 × 375 pixels, file size: 37 KB)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: Graph of selected CDF for binomial distributions that illustrate Condorcet’s Jury Theorem. Created in R using the following code:

     # cf. e.g. 
     # Odd case: DOI:10.1016/0176-2680(93)90010-R
     # Even case with coinflip ties: DOI:10.1007/BF01718092
     library(tidyverse); options(scipen=999); library(ggthemes); library(extrafont)
     theme_set(theme_minimal()); theme_update(legend.position = "bottom", text=element_text(family="Lato"))
     
     f <- function(n,p) {
       h=floor(n/2)+1
       if(n %% 2) {
         return(sum(choose(n,seq(h,n)) * p^seq(h,n) * (1-p)^(n-seq(h,n))))
       } else {
         return((sum(choose(n,seq(h,n)) * p^seq(h,n) * (1-p)^(n-seq(h,n)))) +
           (choose(n,n/2) * p^(n/2) * (1-p)^(n/2)) * 1/2) 
       }
     }
     df = tibble(p = seq(0,1,0.01)) %>% rowwise() %>% 
       mutate("1" = f(1,p), "3" = f(3,p), "12" = f(12,p), "100" = f(100,p)) %>% 
       pivot_longer(c("1","3","12","100"), names_to="N", values_to="pg")
     
     df %>% ggplot(aes(p, pg, color=N)) + geom_line() +
       labs(title = element_blank(), x = element_blank(), y = element_blank()) + 
       scale_color_colorblind(breaks=c(1,3,12,100))
     
     ggsave("cjt.svg", width=1000, height=1000, units="px")
    
    Date
    Source Own work
    Author Jaszczuroczłek

    Licensing

    I, the copyright holder of this work, hereby publish it under the following license:
    w:en:Creative Commons
    attribution share alike
    This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
    You are free:
    • to share – to copy, distribute and transmit the work
    • to remix – to adapt the work
    Under the following conditions:
    • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
    • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

    Captions

    A graph of cumulative binomial distributions corresponding to few example realizations of Condorcet’s Jury Theorem

    Items portrayed in this file

    depicts

    25 October 2021

    image/svg+xml

    484b4fa7ca9a15225a64fbdbe3110fc06bec79ce

    37,507 byte

    375 pixel

    375 pixel

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current19:42, 25 October 2021Thumbnail for version as of 19:42, 25 October 2021375 × 375 (37 KB)wikimediacommons>Jaszczuroczłekimproved legibility for classic Wikipedia; final version for now

    There are no pages that use this file.