Dispersion

R tricks Distributions Gaussian distribution

Post that will link closely to glossary entries and shiny apps all about dispersion, scatter, variance

Chris Evans https://www.psyctc.org/R_blog/ (PSYCTC.org)https://www.psyctc.org/psyctc/
2024-03-11
Show code
### this is the code that creates the "copy to clipboard" function in the code blocks
htmltools::tagList(
  xaringanExtra::use_clipboard(
    button_text = "<i class=\"fa fa-clone fa-2x\" style=\"color: #301e64\"></i>",
    success_text = "<i class=\"fa fa-check fa-2x\" style=\"color: #90BE6D\"></i>",
    error_text = "<i class=\"fa fa-times fa-2x\" style=\"color: #F94144\"></i>"
  ),
  rmarkdown::html_dependency_font_awesome()
)

Dispersion is a useful term in statistics covering the basic idea of how widely scattered values are in a distribution. This blog post is really providing a collection of simulations and plots to illustrate various entries in the glossary for the OMbook.

Here is a trivial example starting from the glossary entry for dispersion.

Show code
### from the glossary
tmp <- c(18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 23, 23, 24, 24, 24, 25, 27, 28, 30, 31)
tmp2 <- c(27, 31, 32, 35, 37, 42, 44, 47, 51, 53, 55, 56, 59, 60, 63, 65, 68, 71, 75, 83)
tibble(data1 = tmp,
       data2 = tmp2) -> tmpTib
tmpTib %>%
  pivot_longer(cols = c(data1, data2)) -> tmpTibLong

ggplot(data = tmpTibLong,
       aes(x = value)) +
  facet_grid(cols = vars(name)) +
  geom_histogram()
Show code
ggsave(filename = "dispersion1.png", width = 800, height = 600, units = "px")

Dates

1 Started 11.iii.24

Visit count

free hit counter

Last updated

Show code
cat(paste(format(Sys.time(), "%d/%m/%Y"), "at", format(Sys.time(), "%H:%M")))
05/04/2024 at 21:30

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY-SA 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

Citation

For attribution, please cite this work as

Evans (2024, March 11). Chris (Evans) R SAFAQ: Dispersion. Retrieved from https://www.psyctc.org/R_blog/posts/2024-03-11-dispersion/

BibTeX citation

@misc{evans2024dispersion,
  author = {Evans, Chris},
  title = {Chris (Evans) R SAFAQ: Dispersion},
  url = {https://www.psyctc.org/R_blog/posts/2024-03-11-dispersion/},
  year = {2024}
}