Moment generating and characteristic functions for empirical distributions of i.i.d. samples

We plot the moment generating and characteristic functions for empirical measures based on i.i.d. samples from normal and exponential distributions, and we compare these to the moment generating and characteristic functions of the normal and exponential distributions themselves.

Plots of some moment generating functions

Plot[{MomentGeneratingFunction[NormalDistribution[],t],MomentGeneratingFunction[ExponentialDistribution[1],t],MomentGeneratingFunction[UniformDistribution[],t]},{t,0,3}]

Plots of some characteristic functions

ParametricPlot3D[{{t/5,Re[CharacteristicFunction[NormalDistribution[],t]],Im[CharacteristicFunction[NormalDistribution[],t]]},
{t/5,Re[CharacteristicFunction[ExponentialDistribution[1],t]],Im[CharacteristicFunction[ExponentialDistribution[1],t]]},
{t/5,Re[CharacteristicFunction[UniformDistribution[],t]],Im[CharacteristicFunction[UniformDistribution[],t]]}},{t,-5,5}]

Empirical distribution of i.i.d. samples and their generating functions

Normal distribution (n=50 samples)

n=50;

data=RandomVariate[NormalDistribution[],n];
𝒟=EmpiricalDistribution[data];
{DiscretePlot[PDF[𝒟,x],{x,data}],DiscretePlot[{CDF[𝒟,x],CDF[NormalDistribution[],x]},{x,-3,3,.01}]}
f[t_]:=Evaluate[MomentGeneratingFunction[𝒟,t]];g[t_]:=Evaluate[MomentGeneratingFunction[NormalDistribution[],t]]
Plot[{f[t],g[t]},{t,0,2}]

f[t_]:=Evaluate[Re[CharacteristicFunction[𝒟,t]]];g[t_]:=Evaluate[Im[CharacteristicFunction[𝒟,t]]];
ParametricPlot3D[{{t/5,f[t],g[t]},{t/5,Re[CharacteristicFunction[NormalDistribution[],t]],Im[CharacteristicFunction[NormalDistribution[],t]]}},{t,-5,5}]

Exponential distribution (n=50 samples)

data=RandomVariate[ExponentialDistribution[1],n];
𝒟=EmpiricalDistribution[data];
{DiscretePlot[PDF[𝒟,x],{x,data}],DiscretePlot[{CDF[𝒟,x],CDF[ExponentialDistribution[1],x]},{x,0,3,.01}]}
f[t_]:=Evaluate[MomentGeneratingFunction[𝒟,t]];g[t_]:=Evaluate[MomentGeneratingFunction[ExponentialDistribution[1],t]]
Plot[{f[t],g[t]},{t,0,2}]

f[t_]:=Evaluate[Re[CharacteristicFunction[𝒟,t]]];g[t_]:=Evaluate[Im[CharacteristicFunction[𝒟,t]]];
ParametricPlot3D[{{t/5,f[t],g[t]},{t/5,Re[CharacteristicFunction[ExponentialDistribution[1],t]],Im[CharacteristicFunction[ExponentialDistribution[1],t]]}},{t,-5,5}]

Empirical distribution of i.i.d. samples and their generating functions

Normal distribution (n=1000 samples)

n=1000;

data=RandomVariate[NormalDistribution[],n];
𝒟=EmpiricalDistribution[data];
{DiscretePlot[PDF[𝒟,x],{x,data}],DiscretePlot[{CDF[𝒟,x],CDF[NormalDistribution[],x]},{x,-3,3,.01}]}
f[t_]:=Evaluate[MomentGeneratingFunction[𝒟,t]];g[t_]:=Evaluate[MomentGeneratingFunction[NormalDistribution[],t]]
Plot[{f[t],g[t]},{t,0,2}]

f[t_]:=Evaluate[Re[CharacteristicFunction[𝒟,t]]];g[t_]:=Evaluate[Im[CharacteristicFunction[𝒟,t]]];
ParametricPlot3D[{{t/5,f[t],g[t]},{t/5,Re[CharacteristicFunction[NormalDistribution[],t]],Im[CharacteristicFunction[NormalDistribution[],t]]}},{t,-5,5}]

Exponential distribution (n=1000 samples)

data=RandomVariate[ExponentialDistribution[1],n];
𝒟=EmpiricalDistribution[data];
{DiscretePlot[PDF[𝒟,x],{x,data}],DiscretePlot[{CDF[𝒟,x],CDF[ExponentialDistribution[1],x]},{x,0,3,.01}]}
f[t_]:=Evaluate[MomentGeneratingFunction[𝒟,t]];g[t_]:=Evaluate[MomentGeneratingFunction[ExponentialDistribution[1],t]]
Plot[{f[t],g[t]},{t,0,2}]

f[t_]:=Evaluate[Re[CharacteristicFunction[𝒟,t]]];g[t_]:=Evaluate[Im[CharacteristicFunction[𝒟,t]]];
ParametricPlot3D[{{t/5,f[t],g[t]},{t/5,Re[CharacteristicFunction[ExponentialDistribution[1],t]],Im[CharacteristicFunction[ExponentialDistribution[1],t]]}},{t,-5,5}]