
MLEtools.nb 1 Reference: some basic distributions An excellent reference for probability distributions is: Evans, Merran, Nicholas Hastings, and Brian Peacock. 2000. Statistical Distributions, 3rd Edition. John Wiley & Sons. New York. Continuous Expected, or mean E Z = zf z „ z Variance VAR Z = E Z - E Z 2 = z - E z 2 f z „ z @ D Ÿ H L For continuous variables, the probability density function is the probability of the value z given the parameters H L @H @ DL D Ÿ H @ DL H L ü Uniform Uniform Distribution: a uniform distribution on the interval [a,b] where a < b probability density function: 1 f z = ÅÅÅÅÅÅÅÅÅÅb-a , where a § z § b b+a mean: ÅÅÅÅÅÅÅÅÅÅ2 b-a 2 variance: ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ12 H L H L ü r dunif z, min = a, max = b # generate 1 uniform random number over the range 1.4 to 2.4 runif H1, 1.4, 2.4 L ü mathematicaH L 1 f z_, a_, b_ := b − a ∗ random number over range 0,1 ∗ @ D Random H0.0407265 L @D ∗ random number of specified range ∗ H L MLEtools.nb 2 Random Real, 3, 6 4.87348 @ 8 <D ü Normal Normal Distribution: has two parameters: m is the location parameter, in this case the mean; s is the scale parameter, in this case the standard deviation probability density function: 2 f z = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ1 exp - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅz-m 2 ps2 2 s2 mean: m H L variance: s2 è!!!!!!!!!!! !!! H L I M note: plotting f z will give you the familiar bell curve ü r H L probability density function dnorm z, mean, sd # plot the pdf curve dnorm x, 4, 1 ,0,7 H L random number generation, where n is the number random numbers to generation. In other words, n = 1 will create 1 random number. H H L L rnorm n, mean, sd ü mathematicaH L 1 z − m 2 f z_, m_, σ_ := Exp − 2 2 π σ2 2 σ Plot f z, 4, 1 , z, 0, 7 ; H L @ D è!!!!!!!!!!!!! A E 0.4 @ @ D 8 <D 0.3 0.2 0.1 1 2 3 4 5 6 7 MLEtools.nb 3 Show that pdf integrates to 1 Integrate f z, 1, 1 , z, −∞, ∞ 1 @ @ D 8 <D << Statistics`ContinuousDistributions` ∗ normal random number with mean of 3 and standard deviation 2 ∗ Random NormalDistribution 3, 2 H1.87451 L @ @ DD ü Lognormal Lognormal Distribution: has two parameters: m is the location parameter; s is the shape parameter probability density function: 1 ln z -log m 2 f z = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ exp - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ2 , where z > 0, m >0, and s >0 z 2 ps2 2 s 2 mean: m exp ÅÅÅÅÅÅÅs 2 H H L H LL median: m è!!!!!!!!!!! !!! H L I M s2 is the variance of the ln(z) variance: m2I expMs2 exp s2 - 1 note: This describes a variable in which the logarithm of the variable is a normal distribution. Whereas the normal distribu- tion is additive, the lognormal distribution is multiplicative. H L H H L L ü r dlnorm z, meanlog = m, sdlog =σ R uses a slightly different form of the lognormal model. Use the following form so that m is defined in the same way as described in the f(zH) equation above. L dlnorm z, log m , σ # generate random number rlnorm H1, meanlogH L = 1,L sdlog = 1.2 ü mathematica H L 1 Log z − Log m 2 f z_, m_, σ_ := Exp − 2 z 2 π σ2 2 σ H @ D @ DL @ D è!!!!!!!!!!!!! A E MLEtools.nb 4 Plot f z, 1.7, 1 , z, 0, 20 ; @ @ D 8 <D 0.3 0.2 0.1 5 10 15 20 Show that pdf integrates to 1 Integrate f z, 1, 1 , z, 0, ∞ 1 @ @ D 8 <D Derive expected value Integrate zf z, m, σ , z, 0, ∞ , Assumptions → σ>0, m > 0, σ∈Reals, m ∈ Reals 2 σ 2 m @ @ D 8 < 8 <D Derive variance Integrate z − Integrate zf z, m, σ , z, 0, ∞ , Assumptions → σ>0, m > 0, σ∈Reals, m ∈ Reals 2 f z, m, σ , z, 0, ∞ , Assumptions → σ>0, m > 0, σ∈Reals, m ∈ Reals @ 2 2 Hσ −1 +σ m2 @ @ D 8 < 8 <DL @ D 8 < 8 <D << Statistics`ContinuousDistributions` ∗ IlognormalM random number with the first number being the Log m and the second number being σ. In the case below, m = 3 and σ=2 ∗ Random LogNormalDistribution Log 3 ,2 H @ D 6.94065 L @ @ @ D DD MLEtools.nb 5 ü Exponential Exponential Distribution: has three parameters: m is the location parameter; s is the shape parameter probability density function: f z = a Exp -az, where z > 0 1 mean: ÅÅÅÅa 1 variance: ÅÅÅÅÅÅÅa2 note: ContinuousH L distribution@ D analog of Poisson. Can be used for dispersal distance. Widely used in Baysian Analysis ü r dexp z, rate = a # generate random number rexp H1, rate = aL ü mathematicaH L f z_, a_ := a Exp −az Plot f z, 0.5 , z, 0, 15 , PlotRange → All ; @ D @ D 0.5 @ @ D 8 < D 0.4 0.3 0.2 0.1 2 4 6 8 10 12 14 << Statistics`ContinuousDistributions` ∗ exponential random number with a = 0.5 ∗ Random ExponentialDistribution 0.5 H2.1514 L @ @ DD MLEtools.nb 6 ü Gamma Gamma Distribution: has two parameters: a is the rate parameter; n is the shape parameter probability density function: an n-1 f z = ÅÅÅÅÅÅÅÅÅÅÅG n Exp -az z , where z > 0 n mean: ÅÅÅÅa n variance: ÅÅÅÅÅÅÅ2 H L H aL @ D note: can have a long tail. When n = 1, the gamma distribution becomes the exponential distribution. When n = degrees of freedom / 2 and a = 2, the gamma distribution becomes the chi-square distribution. ü r dgamma z, shape = n , rate = a # generate random number rgamma H1, shape = n, rate = a L ü mathematica H L an f z_, a_, n_ := Exp −az zn−1 Gamma n Plot f z, 1, 1 , z, 0, 12 , PlotRange → All ; @ D @ D 1 @ D @ @ D 8 < D 0.8 0.6 0.4 0.2 2 4 6 8 10 12 MLEtools.nb 7 Plot f z, 1, 2 , z, 0, 12 , PlotRange → All ; 0.35 @ @ D 8 < D 0.3 0.25 0.2 0.15 0.1 0.05 2 4 6 8 10 12 Plot f z, 0.5, 2 , z, 0, 12 , PlotRange → All ; 0.175 @ @ D 8 < D 0.15 0.125 0.1 0.075 0.05 0.025 2 4 6 8 10 12 Derive expected value Integrate zf z, a, n , z, 0, ∞ , Assumptions → a > 0, n > 0, a ∈ Reals, n ∈ Reals n a @ @ D 8 < 8 <D Derive variance Integrate z − Integrate zf z, a, n , z, 0, ∞ , Assumptions → a > 0, n > 0, a ∈ Reals, n ∈ Reals 2 f z, a, n , z, 0, ∞ , Assumptions → a > 0, n > 0, a ∈ Reals, n ∈ Reals @ n H @ @ D 8 < 8 <DL a2 @ D 8 < 8 <D << Statistics`ContinuousDistributions` ∗ gamma random number with n = 2 and a = 0.5 ∗ Random GammaDistribution 2.0 , 1 0.5 H2.82494 L @ @ ê DD MLEtools.nb 8 ü Chi-Square Note: this section is a bit incomplete Chi-Square Distribution: A squared normal distribution is a chi-square distribution. probability density function for 1 degree of freedom: f z = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ1 ÅÅÅÅÅÅÅÅ exp - ÅÅÅÅÅÅÅÅÅÅÅz 2 ps2 z 2 s2 probability densityè!!!!!!! function!!!! !!!!!! for n degrees of freedom: H L 1 Hn 2 -1 L z f z = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅn n 2ÅÅÅÅÅÅÅÅÅÅÅÅÅÅn z exp - ÅÅÅÅÅÅÅÅÅÅÅ2 , for z ¥ 0 s 2 G ÅÅÅÅ2 2 s mean: n s2 H ê L 4 H ê L variance: 2 n s H L H L H L notes: - n can also be thought of as a shape parameter in the context of a general distribution - often assume unit variance, s = 1 1 - G ÅÅÅÅ2 = p è!!!! ü rH L dchisq ü mathematica HL 1 z f z_, σ_ := Exp − 2 2 π σ2 z 2 σ Plot f z, 2.1 , z, 0, 7 ; @ D è!!!!!!!!!!!!!!!!! A E 1.75 1.5 @ @ D 8 <D 1.25 1 0.75 0.5 0.25 1 2 3 4 5 6 7 Show that pdf integrates to 1 MLEtools.nb 9 Integrate f z, 2.1 , z, 0, ∞ 1. @ @ D 8 <D << Statistics`ContinuousDistributions` ∗ Chi−Square distributed random number with 1 degree of freedom ∗ Random ChiSquareDistribution 1 H0.111756 L @ @ DD Add non-centrality, or location, parameter with a single degree of freedom, although no scale parameter mean: 1 + m Two forms are given below −1 z +μ 1 z 4 f z_, μ_ := Exp − BesselI −1 2, μ z 2 2 μ 1 1 1 è!!!!!!! z +μ f@z_, μ_D := Hypergeometric0F1A E J N , z μ A ê ExpE− 2 4 2 π z 2 NIntegrate f z, 2.0 , z, 0, 100000 @ D A E è!!!!!!!!!!!! A E 1. @ @ D 8 <D NIntegrate zf z, 2.0 , z, 0, 100000 3. @ @ D 8 <D Integrate zf z, μ , z, 0, ∞ , Assumptions → μ>0, μ∈Reals 1 +μ @ @ D 8 < 8 <D 1 1 Hypergeometric0F1 , z μ 2 4 Cosh z μ A E 1 1 z +μ è!!!!!!! μ + − μ − ExpA zE Exp z Exp 2 2 π z 2 è!!!!!!! è!!!!!!! 1 z +μ ExpI Az μ +EExp − A z μ EMè!!!!!!!!!!!! Exp −A E 2 2 π z 2 1è!!!!!!! è!!!!!!!z +μ 1 z +μ IA ExpE zAμ−EM +è!!!!!!!!!!!! AExp − zEμ− 2 2 π z 2 2 2 π z 2 è!!!!!!! è!!!!!!! è!!!!!!!!!!!! A E è!!!!!!!!!!!! A E MLEtools.nb 10 ü Bimodal Normal Normal Distribution: has two parameters: m is the location parameter, in this case the mean; s is the scale parameter, in this case the standard deviation probability density function: 2 f z = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ1 exp - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅz-m 2 ps2 2 s2 mean: m H L variance: s2 è!!!!!!!!!!! !!! H L I M note: plotting f z will give you the familiar bell curve Here I extend that to a bimodal normal distribution.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages26 Page
-
File Size-