Fitting distributions

Pablo Leon-Rodenas| NHSE

February 1, 2024

Distributions

This is a small introduction to distributions and how to fit them to ggplot2 charts.

Load required packages

We start by loading required packages for our analysis. We include echo=TRUE and message=TRUE to display output from rendered r code chuncks.

knitr::opts_chunk$set(echo = TRUE, warning = FALSE, message = FALSE,
                      dpi = 180, fig.width = 8, fig.height = 5)
library(tidyverse)
-- Attaching core tidyverse packages ------------------------ tidyverse 2.0.0 --
v dplyr     1.1.2     v readr     2.1.4
v forcats   1.0.0     v stringr   1.5.0
v ggplot2   3.4.4     v tibble    3.2.1
v lubridate 1.9.2     v tidyr     1.3.0
v purrr     1.0.1     
-- Conflicts ------------------------------------------ tidyverse_conflicts() --
x dplyr::filter() masks stats::filter()
x dplyr::lag()    masks stats::lag()
i Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(janitor)

Attaching package: 'janitor'

The following objects are masked from 'package:stats':

    chisq.test, fisher.test
library(readxl)
library(here)
here() starts at C:/R/WorkingDir/Pablo-source.github.io