R bloggers

Animating mode variability with tidyverse and tweenr

FavoriteLoadingAdd to favorites

Provided different probability distributions, animate independent sample distributions to demonstrate mode variability. There is a thorough code description with some subtle tips and tricks. Not so long time ago I encountered the following task: given several groups of samples (one group – several samples from one distribution) make a visual presentation of sample mode variability in different groups (how sample mode changes between different samples). I decided to do this by animating these distributions with respect to their mode. The whole process can be summarised as follows: For every sample: Count its values. Sample values are considered to a certain degree of precision, e.g. to the third digit, so talking about “counting values” has reasonable background. Divide counts by maximum count. The output is named “mode share distribution” (made up term, didn’t find any present one). For every unique value in…
Original Post: Animating mode variability with tidyverse and tweenr