class: center, middle, inverse, title-slide .title[ # ma206distributions and ma206equations ] .subtitle[ ## independent studies ] .author[ ### ER, IF, MJ ] --- <style type="text/css"> .remark-code{line-height: 1.5; font-size: 90%} @media print { .has-continuation { display: block; } } code.r.hljs.remark-code{ position: relative; overflow-x: hidden; } code.r.hljs.remark-code:hover{ overflow-x:visible; width: 500px; border-style: solid; } </style> --- --- # Mathematical fluency involves frequent use of probability distributions. However, visualizing these distributions can be tedious. In a well-defined statistics and probability curriculum, the set of distributions to be mastered is known and limited. In such settings having shortcuts to produce or ingest these distributions in analytic software for display and analysis could be beneficial for students and instructors alike. The goal of this project is to provide ready-to-use objects (data frames) and functions that will make it easier to engage computationally with these distributions. We make these objects and functions available in the R package `ma206distributions`. In this independent study, we've focus especially on the binomial and geometric distributions as targets to be used and mastered to explore the potential for ma206distributions. --- count: false .panel1-pipeline-auto[ ```r *library(dplyr) ``` ] .panel2-pipeline-auto[ ] --- count: false .panel1-pipeline-auto[ ```r library(dplyr) *bernoulli_trial(prob = .5) ``` ] .panel2-pipeline-auto[ ``` # A tibble: 2 × 2 outcome prob <int> <dbl> 1 0 0.5 2 1 0.5 ``` ] --- count: false .panel1-pipeline-auto[ ```r library(dplyr) bernoulli_trial(prob = .5) %>% * add_trials() ``` ] .panel2-pipeline-auto[ ``` # A tibble: 4 × 4 t1_outcome t1_prob t2_outcome t2_prob <int> <dbl> <int> <dbl> 1 0 0.5 0 0.5 2 0 0.5 1 0.5 3 1 0.5 0 0.5 4 1 0.5 1 0.5 ``` ] --- count: false .panel1-pipeline-auto[ ```r library(dplyr) bernoulli_trial(prob = .5) %>% add_trials() %>% * add_trials() ``` ] .panel2-pipeline-auto[ ``` # A tibble: 8 × 6 t1_outcome t1_prob t2_outcome t2_prob t3_outcome t3_prob <int> <dbl> <int> <dbl> <int> <dbl> 1 0 0.5 0 0.5 0 0.5 2 0 0.5 0 0.5 1 0.5 3 0 0.5 1 0.5 0 0.5 4 0 0.5 1 0.5 1 0.5 5 1 0.5 0 0.5 0 0.5 6 1 0.5 0 0.5 1 0.5 7 1 0.5 1 0.5 0 0.5 8 1 0.5 1 0.5 1 0.5 ``` ] --- count: false .panel1-pipeline-auto[ ```r library(dplyr) bernoulli_trial(prob = .5) %>% add_trials() %>% add_trials() %>% * add_trials() ``` ] .panel2-pipeline-auto[ ``` # A tibble: 16 × 8 t1_outcome t1_prob t2_outcome t2_prob t3_outcome t3_prob t4_outcome t4_prob <int> <dbl> <int> <dbl> <int> <dbl> <int> <dbl> 1 0 0.5 0 0.5 0 0.5 0 0.5 2 0 0.5 0 0.5 0 0.5 1 0.5 3 0 0.5 0 0.5 1 0.5 0 0.5 4 0 0.5 0 0.5 1 0.5 1 0.5 5 0 0.5 1 0.5 0 0.5 0 0.5 6 0 0.5 1 0.5 0 0.5 1 0.5 7 0 0.5 1 0.5 1 0.5 0 0.5 8 0 0.5 1 0.5 1 0.5 1 0.5 9 1 0.5 0 0.5 0 0.5 0 0.5 10 1 0.5 0 0.5 0 0.5 1 0.5 11 1 0.5 0 0.5 1 0.5 0 0.5 12 1 0.5 0 0.5 1 0.5 1 0.5 13 1 0.5 1 0.5 0 0.5 0 0.5 14 1 0.5 1 0.5 0 0.5 1 0.5 15 1 0.5 1 0.5 1 0.5 0 0.5 16 1 0.5 1 0.5 1 0.5 1 0.5 ``` ] --- count: false .panel1-pipeline-auto[ ```r library(dplyr) bernoulli_trial(prob = .5) %>% add_trials() %>% add_trials() %>% add_trials() %>% * .$out ``` ] .panel2-pipeline-auto[ ``` # A tibble: 16 × 8 t1_outcome t1_prob t2_outcome t2_prob t3_outcome t3_prob t4_outcome t4_prob <int> <dbl> <int> <dbl> <int> <dbl> <int> <dbl> 1 0 0.5 0 0.5 0 0.5 0 0.5 2 0 0.5 0 0.5 0 0.5 1 0.5 3 0 0.5 0 0.5 1 0.5 0 0.5 4 0 0.5 0 0.5 1 0.5 1 0.5 5 0 0.5 1 0.5 0 0.5 0 0.5 6 0 0.5 1 0.5 0 0.5 1 0.5 7 0 0.5 1 0.5 1 0.5 0 0.5 8 0 0.5 1 0.5 1 0.5 1 0.5 9 1 0.5 0 0.5 0 0.5 0 0.5 10 1 0.5 0 0.5 0 0.5 1 0.5 11 1 0.5 0 0.5 1 0.5 0 0.5 12 1 0.5 0 0.5 1 0.5 1 0.5 13 1 0.5 1 0.5 0 0.5 0 0.5 14 1 0.5 1 0.5 0 0.5 1 0.5 15 1 0.5 1 0.5 1 0.5 0 0.5 16 1 0.5 1 0.5 1 0.5 1 0.5 ``` ] --- count: false .panel1-pipeline-auto[ ```r library(dplyr) bernoulli_trial(prob = .5) %>% add_trials() %>% add_trials() %>% add_trials() %>% .$out %>% * sum_across() ``` ] .panel2-pipeline-auto[ ``` # A tibble: 16 × 9 t1_outcome t1_prob t2_outcome t2_prob t3_outcome t3_prob t4_outcome t4_prob global_outcome <int> <dbl> <int> <dbl> <int> <dbl> <int> <dbl> <dbl> 1 0 0.5 0 0.5 0 0.5 0 0.5 0 2 0 0.5 0 0.5 0 0.5 1 0.5 1 3 0 0.5 0 0.5 1 0.5 0 0.5 1 4 0 0.5 0 0.5 1 0.5 1 0.5 2 5 0 0.5 1 0.5 0 0.5 0 0.5 1 6 0 0.5 1 0.5 0 0.5 1 0.5 2 7 0 0.5 1 0.5 1 0.5 0 0.5 2 8 0 0.5 1 0.5 1 0.5 1 0.5 3 9 1 0.5 0 0.5 0 0.5 0 0.5 1 10 1 0.5 0 0.5 0 0.5 1 0.5 2 11 1 0.5 0 0.5 1 0.5 0 0.5 2 12 1 0.5 0 0.5 1 0.5 1 0.5 3 13 1 0.5 1 0.5 0 0.5 0 0.5 2 14 1 0.5 1 0.5 0 0.5 1 0.5 3 15 1 0.5 1 0.5 1 0.5 0 0.5 3 16 1 0.5 1 0.5 1 0.5 1 0.5 4 ``` ] --- count: false .panel1-pipeline-auto[ ```r library(dplyr) bernoulli_trial(prob = .5) %>% add_trials() %>% add_trials() %>% add_trials() %>% .$out %>% sum_across() %>% * prod_across() ``` ] .panel2-pipeline-auto[ ``` # A tibble: 16 × 10 t1_outcome t1_prob t2_outcome t2_prob t3_outcome t3_prob t4_outcome t4_prob global_outcome global_probs <int> <dbl> <int> <dbl> <int> <dbl> <int> <dbl> <dbl> <dbl> 1 0 0.5 0 0.5 0 0.5 0 0.5 0 0.0625 2 0 0.5 0 0.5 0 0.5 1 0.5 1 0.0625 3 0 0.5 0 0.5 1 0.5 0 0.5 1 0.0625 4 0 0.5 0 0.5 1 0.5 1 0.5 2 0.0625 5 0 0.5 1 0.5 0 0.5 0 0.5 1 0.0625 6 0 0.5 1 0.5 0 0.5 1 0.5 2 0.0625 7 0 0.5 1 0.5 1 0.5 0 0.5 2 0.0625 8 0 0.5 1 0.5 1 0.5 1 0.5 3 0.0625 9 1 0.5 0 0.5 0 0.5 0 0.5 1 0.0625 10 1 0.5 0 0.5 0 0.5 1 0.5 2 0.0625 11 1 0.5 0 0.5 1 0.5 0 0.5 2 0.0625 12 1 0.5 0 0.5 1 0.5 1 0.5 3 0.0625 13 1 0.5 1 0.5 0 0.5 0 0.5 2 0.0625 14 1 0.5 1 0.5 0 0.5 1 0.5 3 0.0625 15 1 0.5 1 0.5 1 0.5 0 0.5 3 0.0625 16 1 0.5 1 0.5 1 0.5 1 0.5 4 0.0625 ``` ] --- count: false .panel1-pipeline-auto[ ```r library(dplyr) bernoulli_trial(prob = .5) %>% add_trials() %>% add_trials() %>% add_trials() %>% .$out %>% sum_across() %>% prod_across() %>% * group_by(global_outcome) ``` ] .panel2-pipeline-auto[ ``` # A tibble: 16 × 10 # Groups: global_outcome [5] t1_outcome t1_prob t2_outcome t2_prob t3_outcome t3_prob t4_outcome t4_prob global_outcome global_probs <int> <dbl> <int> <dbl> <int> <dbl> <int> <dbl> <dbl> <dbl> 1 0 0.5 0 0.5 0 0.5 0 0.5 0 0.0625 2 0 0.5 0 0.5 0 0.5 1 0.5 1 0.0625 3 0 0.5 0 0.5 1 0.5 0 0.5 1 0.0625 4 0 0.5 0 0.5 1 0.5 1 0.5 2 0.0625 5 0 0.5 1 0.5 0 0.5 0 0.5 1 0.0625 6 0 0.5 1 0.5 0 0.5 1 0.5 2 0.0625 7 0 0.5 1 0.5 1 0.5 0 0.5 2 0.0625 8 0 0.5 1 0.5 1 0.5 1 0.5 3 0.0625 9 1 0.5 0 0.5 0 0.5 0 0.5 1 0.0625 10 1 0.5 0 0.5 0 0.5 1 0.5 2 0.0625 11 1 0.5 0 0.5 1 0.5 0 0.5 2 0.0625 12 1 0.5 0 0.5 1 0.5 1 0.5 3 0.0625 13 1 0.5 1 0.5 0 0.5 0 0.5 2 0.0625 14 1 0.5 1 0.5 0 0.5 1 0.5 3 0.0625 15 1 0.5 1 0.5 1 0.5 0 0.5 3 0.0625 16 1 0.5 1 0.5 1 0.5 1 0.5 4 0.0625 ``` ] --- count: false .panel1-pipeline-auto[ ```r library(dplyr) bernoulli_trial(prob = .5) %>% add_trials() %>% add_trials() %>% add_trials() %>% .$out %>% sum_across() %>% prod_across() %>% group_by(global_outcome) %>% * summarize(probs = sum(global_probs)) ``` ] .panel2-pipeline-auto[ ``` # A tibble: 5 × 2 global_outcome probs <dbl> <dbl> 1 0 0.0625 2 1 0.25 3 2 0.375 4 3 0.25 5 4 0.0625 ``` ] <style> .panel1-pipeline-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-pipeline-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-pipeline-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false .panel1-pipeline2-auto[ ```r *bernoulli_trial(prob = .25) ``` ] .panel2-pipeline2-auto[ ``` # A tibble: 2 × 2 outcome prob <int> <dbl> 1 0 0.75 2 1 0.25 ``` ] --- count: false .panel1-pipeline2-auto[ ```r bernoulli_trial(prob = .25) %>% * add_trials(3) ``` ] .panel2-pipeline2-auto[ ``` # A tibble: 16 × 8 t1_outcome t1_prob t2_outcome t2_prob t3_outcome t3_prob t4_outcome t4_prob <int> <dbl> <int> <dbl> <int> <dbl> <int> <dbl> 1 0 0.75 0 0.75 0 0.75 0 0.75 2 0 0.75 0 0.75 0 0.75 1 0.25 3 0 0.75 0 0.75 1 0.25 0 0.75 4 0 0.75 0 0.75 1 0.25 1 0.25 5 0 0.75 1 0.25 0 0.75 0 0.75 6 0 0.75 1 0.25 0 0.75 1 0.25 7 0 0.75 1 0.25 1 0.25 0 0.75 8 0 0.75 1 0.25 1 0.25 1 0.25 9 1 0.25 0 0.75 0 0.75 0 0.75 10 1 0.25 0 0.75 0 0.75 1 0.25 11 1 0.25 0 0.75 1 0.25 0 0.75 12 1 0.25 0 0.75 1 0.25 1 0.25 13 1 0.25 1 0.25 0 0.75 0 0.75 14 1 0.25 1 0.25 0 0.75 1 0.25 15 1 0.25 1 0.25 1 0.25 0 0.75 16 1 0.25 1 0.25 1 0.25 1 0.25 ``` ] --- count: false .panel1-pipeline2-auto[ ```r bernoulli_trial(prob = .25) %>% add_trials(3) %>% * .$out ``` ] .panel2-pipeline2-auto[ ``` # A tibble: 16 × 8 t1_outcome t1_prob t2_outcome t2_prob t3_outcome t3_prob t4_outcome t4_prob <int> <dbl> <int> <dbl> <int> <dbl> <int> <dbl> 1 0 0.75 0 0.75 0 0.75 0 0.75 2 0 0.75 0 0.75 0 0.75 1 0.25 3 0 0.75 0 0.75 1 0.25 0 0.75 4 0 0.75 0 0.75 1 0.25 1 0.25 5 0 0.75 1 0.25 0 0.75 0 0.75 6 0 0.75 1 0.25 0 0.75 1 0.25 7 0 0.75 1 0.25 1 0.25 0 0.75 8 0 0.75 1 0.25 1 0.25 1 0.25 9 1 0.25 0 0.75 0 0.75 0 0.75 10 1 0.25 0 0.75 0 0.75 1 0.25 11 1 0.25 0 0.75 1 0.25 0 0.75 12 1 0.25 0 0.75 1 0.25 1 0.25 13 1 0.25 1 0.25 0 0.75 0 0.75 14 1 0.25 1 0.25 0 0.75 1 0.25 15 1 0.25 1 0.25 1 0.25 0 0.75 16 1 0.25 1 0.25 1 0.25 1 0.25 ``` ] --- count: false .panel1-pipeline2-auto[ ```r bernoulli_trial(prob = .25) %>% add_trials(3) %>% .$out %>% * seq_across() ``` ] .panel2-pipeline2-auto[ ``` # A tibble: 16 × 9 t1_outcome t1_prob t2_outcome t2_prob t3_outcome t3_prob t4_outcome t4_prob global_outcome <int> <dbl> <int> <dbl> <int> <dbl> <int> <dbl> <chr> 1 0 0.75 0 0.75 0 0.75 0 0.75 0, 0, 0, 0 2 0 0.75 0 0.75 0 0.75 1 0.25 0, 0, 0, 1 3 0 0.75 0 0.75 1 0.25 0 0.75 0, 0, 1, 0 4 0 0.75 0 0.75 1 0.25 1 0.25 0, 0, 1, 1 5 0 0.75 1 0.25 0 0.75 0 0.75 0, 1, 0, 0 6 0 0.75 1 0.25 0 0.75 1 0.25 0, 1, 0, 1 7 0 0.75 1 0.25 1 0.25 0 0.75 0, 1, 1, 0 8 0 0.75 1 0.25 1 0.25 1 0.25 0, 1, 1, 1 9 1 0.25 0 0.75 0 0.75 0 0.75 1, 0, 0, 0 10 1 0.25 0 0.75 0 0.75 1 0.25 1, 0, 0, 1 11 1 0.25 0 0.75 1 0.25 0 0.75 1, 0, 1, 0 12 1 0.25 0 0.75 1 0.25 1 0.25 1, 0, 1, 1 13 1 0.25 1 0.25 0 0.75 0 0.75 1, 1, 0, 0 14 1 0.25 1 0.25 0 0.75 1 0.25 1, 1, 0, 1 15 1 0.25 1 0.25 1 0.25 0 0.75 1, 1, 1, 0 16 1 0.25 1 0.25 1 0.25 1 0.25 1, 1, 1, 1 ``` ] --- count: false .panel1-pipeline2-auto[ ```r bernoulli_trial(prob = .25) %>% add_trials(3) %>% .$out %>% seq_across() %>% * prod_across() ``` ] .panel2-pipeline2-auto[ ``` # A tibble: 16 × 10 t1_outcome t1_prob t2_outcome t2_prob t3_outcome t3_prob t4_outcome t4_prob global_outcome global_probs <int> <dbl> <int> <dbl> <int> <dbl> <int> <dbl> <chr> <dbl> 1 0 0.75 0 0.75 0 0.75 0 0.75 0, 0, 0, 0 0.316 2 0 0.75 0 0.75 0 0.75 1 0.25 0, 0, 0, 1 0.105 3 0 0.75 0 0.75 1 0.25 0 0.75 0, 0, 1, 0 0.105 4 0 0.75 0 0.75 1 0.25 1 0.25 0, 0, 1, 1 0.0352 5 0 0.75 1 0.25 0 0.75 0 0.75 0, 1, 0, 0 0.105 6 0 0.75 1 0.25 0 0.75 1 0.25 0, 1, 0, 1 0.0352 7 0 0.75 1 0.25 1 0.25 0 0.75 0, 1, 1, 0 0.0352 8 0 0.75 1 0.25 1 0.25 1 0.25 0, 1, 1, 1 0.0117 9 1 0.25 0 0.75 0 0.75 0 0.75 1, 0, 0, 0 0.105 10 1 0.25 0 0.75 0 0.75 1 0.25 1, 0, 0, 1 0.0352 11 1 0.25 0 0.75 1 0.25 0 0.75 1, 0, 1, 0 0.0352 12 1 0.25 0 0.75 1 0.25 1 0.25 1, 0, 1, 1 0.0117 13 1 0.25 1 0.25 0 0.75 0 0.75 1, 1, 0, 0 0.0352 14 1 0.25 1 0.25 0 0.75 1 0.25 1, 1, 0, 1 0.0117 15 1 0.25 1 0.25 1 0.25 0 0.75 1, 1, 1, 0 0.0117 16 1 0.25 1 0.25 1 0.25 1 0.25 1, 1, 1, 1 0.00391 ``` ] --- count: false .panel1-pipeline2-auto[ ```r bernoulli_trial(prob = .25) %>% add_trials(3) %>% .$out %>% seq_across() %>% prod_across() %>% * group_by(global_outcome) ``` ] .panel2-pipeline2-auto[ ``` # A tibble: 16 × 10 # Groups: global_outcome [16] t1_outcome t1_prob t2_outcome t2_prob t3_outcome t3_prob t4_outcome t4_prob global_outcome global_probs <int> <dbl> <int> <dbl> <int> <dbl> <int> <dbl> <chr> <dbl> 1 0 0.75 0 0.75 0 0.75 0 0.75 0, 0, 0, 0 0.316 2 0 0.75 0 0.75 0 0.75 1 0.25 0, 0, 0, 1 0.105 3 0 0.75 0 0.75 1 0.25 0 0.75 0, 0, 1, 0 0.105 4 0 0.75 0 0.75 1 0.25 1 0.25 0, 0, 1, 1 0.0352 5 0 0.75 1 0.25 0 0.75 0 0.75 0, 1, 0, 0 0.105 6 0 0.75 1 0.25 0 0.75 1 0.25 0, 1, 0, 1 0.0352 7 0 0.75 1 0.25 1 0.25 0 0.75 0, 1, 1, 0 0.0352 8 0 0.75 1 0.25 1 0.25 1 0.25 0, 1, 1, 1 0.0117 9 1 0.25 0 0.75 0 0.75 0 0.75 1, 0, 0, 0 0.105 10 1 0.25 0 0.75 0 0.75 1 0.25 1, 0, 0, 1 0.0352 11 1 0.25 0 0.75 1 0.25 0 0.75 1, 0, 1, 0 0.0352 12 1 0.25 0 0.75 1 0.25 1 0.25 1, 0, 1, 1 0.0117 13 1 0.25 1 0.25 0 0.75 0 0.75 1, 1, 0, 0 0.0352 14 1 0.25 1 0.25 0 0.75 1 0.25 1, 1, 0, 1 0.0117 15 1 0.25 1 0.25 1 0.25 0 0.75 1, 1, 1, 0 0.0117 16 1 0.25 1 0.25 1 0.25 1 0.25 1, 1, 1, 1 0.00391 ``` ] --- count: false .panel1-pipeline2-auto[ ```r bernoulli_trial(prob = .25) %>% add_trials(3) %>% .$out %>% seq_across() %>% prod_across() %>% group_by(global_outcome) %>% * summarize(probs = sum(global_probs)) ``` ] .panel2-pipeline2-auto[ ``` # A tibble: 16 × 2 global_outcome probs <chr> <dbl> 1 0, 0, 0, 0 0.316 2 0, 0, 0, 1 0.105 3 0, 0, 1, 0 0.105 4 0, 0, 1, 1 0.0352 5 0, 1, 0, 0 0.105 6 0, 1, 0, 1 0.0352 7 0, 1, 1, 0 0.0352 8 0, 1, 1, 1 0.0117 9 1, 0, 0, 0 0.105 10 1, 0, 0, 1 0.0352 11 1, 0, 1, 0 0.0352 12 1, 0, 1, 1 0.0117 13 1, 1, 0, 0 0.0352 14 1, 1, 0, 1 0.0117 15 1, 1, 1, 0 0.0117 16 1, 1, 1, 1 0.00391 ``` ] <style> .panel1-pipeline2-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-pipeline2-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-pipeline2-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style>