Animated distributions

The animate.sty package is a useful tool for creating Javascript driven animations in PDF files. In this example it is used to animate probability distributions with varying parameters. GNUPLOT is used to compute the distribution curves. Download the PDF to see the animation.

Update: Example recompiled using animate.sty version 2008-05-16. Animation should now render correctly in all versions of Acrobat Reader v >= 6.0.

Note

Acrobat Reader v >= 6.0 is required to view this example.

This example takes some time to compile. A large number of auxiliary files will be created.

Docutils System Messages

System Message: ERROR/3 (./animated-distributions.txt)

Anonymous hyperlink mismatch: 0 references but 1 targets. See "backrefs" attribute for IDs.


animated-distributions

Edit and compile if you like:

% Animated distributions
% Author: Brian S. Marks
%
% Note that shell-escape has to be enabled to generate the plots.
% The animations can only be viewed in Acrobat (Reader) v >= 6.
\documentclass{beamer}
\usepackage{tikz}
\usepackage{animate}
% Define a the counter cnt. Used to identify files generated for use
% with Gnuplot.
\newcounter{cnt}
\setcounter{cnt}{0}
% Macro for drawing one frame of the F-distribution animation.
\newcommand{\fdst}[4]{%
% shade the critical region tail
\draw[fill,orange] (#1,0) -- plot[id=5\thecnt,domain=#1:5.5,samples=50]
function {#4*(x**(0.5*#2-1))*((1+#2*x/#3)**(-0.5*#2-0.5*#3))}
-- (5.5,0) -- cycle;
% draw the F distribution curve
\draw[color=blue!50!black,thick]
plot[id=f4\thecnt,smooth,domain=0:5.5,samples=100]
function {#4*(x**(0.5*#2-1))*((1+#2*x/#3)**(-0.5*#2-0.5*#3))};
% draw the F axis
\draw[->] (0,0) -- (6,0) node[right] {$F$};
% label the critical region boundary
\draw (#1,0) -- (#1,-0.02) node[below] {$#1$};
% label 0
\draw (0,0) -- (0,-0.02) node[below] {$0$};
% add some lables for degrees of freedom and alpha level
\draw (2,0.5) node[right] {$df_1 = #2$};
\draw (2,0.4) node[right] {$df_2 = #3$};
\draw (2,0.3) node[right] {$\alpha = 0.10$};
% draw the y axis
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Click to download: animated-distributions.texanimated-distributions.pdf
Open in Overleaf: animated-distributions.tex