
Central Limit Theorem Example: the Gamma distribution Basic properties nu lambda nu-1 In[448]:= fgamma[x_, nu_, lambda_] := x Exp[-lambda x] Gamma[nu] In[449]:= plotOrig = Plot[fgamma[x, 3, 1], {x, 0, 7}, Frame → True, AxesStyle → {Directive[Black, 15], Directive[Black, 15]}, LabelStyle → Directive[Black, 18], ImageSize → 800, FrameStyle → {Thick, Directive[Thick]}, PlotStyle → Black] 0.25 0.20 0.15 Out[449]= 0.10 0.05 0.00 0 1 2 3 4 5 Normalization : 2 L3m.nb ∞ In[450]:= FullSimplify fgamma[x, nu, lambda] ⅆ x, 0 Assumptions → {nu > 0, Re[lambda] > 0} Out[450]= 1 Mean : ∞ In[451]:= mu = FullSimplify x fgamma[x, nu, lambda] ⅆ x, 0 Assumptions → {nu > 0, Re[lambda] > 0} nu Out[451]= lambda Variance : ∞ 2 2 In[452]:= sigma2 = FullSimplify x fgamma[x, nu, lambda] ⅆ x - mu , 0 Assumptions → {nu > 0, Re[lambda] > 0} nu Out[452]= lambda2 Skewness : In[453]:= gamma1 = FullSimplify 1 ∞ (x - mu)3 fgamma[x, nu, lambda] ⅆ x, 3/2 (sigma2) 0 Assumptions → {nu > 0, Re[lambda] > 0} 2 Out[453]= nu Kurtosis : L3m.nb 3 In[454]:= beta2 = FullSimplify 1 ∞ (x - mu)4 fgamma[x, nu, lambda] ⅆ x, 2 (sigma2) 0 Assumptions → {nu > 0, Re[lambda] > 0} 6 Out[454]= 3 + nu In[455]:= gamma2 = beta2 - 3 6 Out[455]= nu Central limit theorem As in lecture, let' s change variables to y = (x - mu) . Then characteristic function is : N sigma2 In[456]:= FullSimplify ∞ (x - mu) Expⅈ t fgamma[x, nu, lambda] ⅆ x, 0 N sigma2 Assumptions → Re[nu] > 0 && ((Im[t] + Re[lambda] ⩵ 0 && Re[nu] < 1) || Im[t] + Re[lambda] > 0) && t Im + Re[lambda] > 0 && lambda > 0 N nu lambda2 ⅈ -nu - nu t ⅈ t Out[456]= ⅇ N nu 1 - N nu 4 L3m.nb Characteristic function defined : -nu - ⅈ nu t ⅈ t In[457]:= phi[t_, nu_, N_] := ⅇ N nu 1 - N nu For our example let' s focus on nu = 1, the exponential distribution : In[470]:= plotOrig2 = Plot[fgamma[x, 1, 1], {x, 0, 5}, Frame → True, AxesStyle → {Directive[Black, 15], Directive[Black, 15]}, LabelStyle → Directive[Black, 18], ImageSize → 800, FrameStyle → {Thick, Directive[Thick]}, PlotStyle → Black] 1.0 0.8 0.6 Out[470]= 0.4 0.2 0.0 0 1 2 3 Now let' s determine the distribution of N s that satisfy L3m.nb 5 distribution of N i.i.d' s that satisfy the underlying Gamma distribution : (this integrates analytially to the exponential integral but we' ll evaluate numerically) 1 In[458]:= fN[y_, N_] := NIntegrate 2 π Exp[-ⅈ t y] (phi[t, 1, N])N, {t, -20, 20} Let' s evaluate this for increasing N and compare to the normal distribution : In[459]:= barfN1 = Table[{xx, Re[fN[xx - 1, 1]]}, {xx, -4, 4, .1}]; fN1plot = ListPlot[barfN1, PlotStyle → Red, Frame → True, Joined → True, PlotRange → {{-5, 5}, {-.1, 1.1}}]; barfN3 = Table[{xx, Re[fN[xx - 1, 3]]}, {xx, -4, 4, .1}]; fN3plot = ListPlot[barfN3, PlotStyle → Green, Frame → True, Joined → True]; barfN5 = Table[{xx, Re[fN[xx - 1, 10]]}, {xx, -4, 4, .1}]; fN5plot = ListPlot[barfN5, PlotStyle → Blue, Frame → True, Joined → True]; Here' s the normal distribution : 1 (xx - 1)2 In[465]:= fgauss[xx_] := Exp- 2 π 2 In[466]:= plotgauss = Plot[fgauss[xx], {xx, -5, 5}, PlotStyle → Black]; 6 L3m.nb In[471]:= Show[plotOrig2, fN1plot, fN3plot, fN5plot, plotgauss, PlotRange → {{-2, 5}, {-.1, 1.1}}, FrameLabel → {"y", "fN(y)"}, LabelStyle → Directive[Black, 25]] 1.0 0.8 0.6 ) y ( N f Out[471]= 0.4 0.2 0.0 -2 -1 0 1 2 3 y Example Basic properties 3 1 In[472]:= ftest[x_] := 2 (1 + Abs[x])4 L3m.nb 7 In[473]:= plotOrig = LogPlot[ftest[x], {x, -5, 5}, Frame → True, AxesStyle → {Directive[Black, 15], Directive[Black, 15]}, LabelStyle → Directive[Black, 18], ImageSize → 800, FrameStyle → {Thick, Directive[Thick]}, PlotStyle → Black] 1 0.500 0.100 0.050 Out[473]= 0.010 0.005 0.001 -4 -2 0 2 Normalization : ∞ In[532]:= ftest[x] ⅆ x -∞ Out[532]= 1 Mean : 8 L3m.nb ∞ In[475]:= mu = x ftest[x] ⅆ x -∞ Out[475]= 0 Variance : ∞ 2 In[476]:= sigma2 = x ftest[x] ⅆ x -∞ Out[476]= 1 Note that higher moments diverge! ∞ 3 In[477]:= x ftest[x] ⅆ x -∞ 3 x3 Integrate: Integral of does not converge on {-∞, ∞}. 2 (1 + Abs[x])4 ∞ 3 x3 Out[477]= ⅆx -∞ 2 (1 + Abs[x])4.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages8 Page
-
File Size-