P. 1
Appendix - Distributions

# Appendix - Distributions

|Views: 47|Likes:

See more
See less

08/09/2013

pdf

text

original

# DISTRIBUTIONS

512

18.2

Continuous univariate distributions

Table 18.1 Beta density: Beta(α, β) Model p(θ) =
1 B(α,β)

Examples θα−1 (1 − θ)β−1
Γ(α)Γ(β) Γ(α+β)
Density

3.0

α = 4, β = 1 α = 0.2, β = 6

2.0

with B(α, β) =

2.5

α = 3, β = 3 α = 0.7, β = 0.7

1.5

Condition: α > 0, β > 0 Range: [0,1] Parameters: α, β: shape Moments mean: mode: variance:
α (α+β) α−1 (α+β−2) αβ (α+β)2 (α+β+1)

0.0

0.5

1.0

α = 1, β = 1

0.0

0.2

0.4

0.6

0.8

1.0

θ

Program commands R: dbeta(theta,alpha,beta)

WB/JAGS: theta ~ dbeta(alpha,beta) SAS: theta ~ beta(alpha,beta)

DISTRIBUTIONS Table 18.2 Cauchy distribution: Cauchy(µ, σ) Model p(θ) = (
1 π σ σ 2 +(θ−µ)2

513

Examples )
0.5 0.4 N(µ = 5, σ = 1)

Condition: σ > 0 Range: (−∞, ∞) Parameters: µ: location, σ: scale

Density

0.2

0.3

µ = 5, σ = 1

µ = 7, σ = 1

µ = 4, σ = 2 0.1 0.0 0

2

4

6

8

10

θ

Moments mean: mode: variance: µ -

Program commands R: WB/JAGS: SAS: dcauchy(theta,mu,sigma) theta ~ cauchy(mu,sigma)

Note: Cauchy distribution is a special case of location-scale t-distribution: Cauchy(µ, σ) = t(1, µ, σ).

otherwise − Program commands R: WB/JAGS: SAS: dchisq(theta.0 ν=1 0. JAGS oﬀers a non-central χ2 -distribution: ‘theta ∼ dnchisqr(nu. nu2 = dfs of numerator and denominator.4 0. ∞) otherwise : (0.2 0.6 ν = 0.DISTRIBUTIONS Table 18. nu2)’.0 0 2 4 6 8 θ Moments mean: mode: nu ν − 2 (ν ≥ 2). ∞) Parameters: ν: degrees of freedom Density 0.01 ν=5 ν = 10 0. with nu1. β = 1/2) (rate). δ > 0 non-centrality parameter.8 514 Examples Condition: ν > 0 Range: ν = 2 : [0. .nu) theta ~ dchisqr(nu) theta ~ chisq(nu) variance: 2ν Note: Chi-squared is a special case of a gamma distribution: χ2 (ν) = Gamma(α = ν/2. JAGS oﬀers an F-distribution (ratio of 2 independent χ2 s): ‘theta ∼ df(nu1.3 Chi-squared density: χ2 (ν) Model p(θ) = 1 θ(ν/2)−1 e−θ/2 Γ(ν/2)2ν/2 1.delta)’. resp.

∞) Parameters: λ: rate 1.0 λ = 0.lambda) 0 1 λ2 WB/JAGS: theta ~ dexp(lambda) SAS: (scale) theta ~ expon(iscale=lambda) theta ~ expon(scale=ilambda) Note: Exponential is special case of gamma distribution: Exp(λ)= Gamma(α = 1.1 0 λ=1 2 4 6 8 θ Moments rate: mean: mode: variance: λ 1 λ Program commands R: dexp(theta.4 Exponential density: Exp(λ) Model rate: p(θ) = λe−λθ Density 515 Examples 3.0 2. .5 λ=2 0.5 0.0 1.DISTRIBUTIONS Table 18.0 λ=4 rate = λ Condition: λ > 0 Range: [0.5 2. λ).

gamma(alpha.scale=ibeta) Note: WB and JAGS oﬀer a generalized gamma distribution GenGamma: θ ∼ GenGamma(α.1 1/scale = β Condition: α > 0. λ) ⇔ θ1/λ ∼ Gamma(α. β = 20 Density 1.iscale=beta) theta ~ gamma(alpha.5 α = 20.5 α = 1. β: rate 2.rate=beta) dgamma(theta.0 2. β ∗ . ∞) otherwise : [0.0 α = 0.5 0.DISTRIBUTIONS Table 18. β). with β ∗ = β 1/λ . WB/JAGS command: ‘theta ∼ dgen. β = 1 α = 4. β = 0.beta) theta ~ gamma(alpha.scale=ibeta) theta ~ dgamma(alpha. ∞) Parameters: α: shape.1.0 0 2 4 6 8 θ Moments rate: mean: mode: variance: β α β α−1 β α β2 Program commands R: (scale) (α ≥ 1) WB/JAGS: SAS: (scale) dgamma(theta.beta.0 1. . β > 0 Range: α = 1 : (0.5 Gamma density: Gamma(α. β) Model rate: p(θ) = βα Γ(α) 516 Examples θ(α−1) e−βθ 3. β = 1 0.alpha.lambda)’.alpha.

∞) Parameters: ν: degrees of freedom Density 1 2 3 ν=3 ν=1 0 0 5 10 15 θ Moments mean: mode: variance: 1 ν−2 1 ν+2 Program commands (ν > 2) R: WB/JAGS: (ν > 4) SAS: dchisq(1/theta. Inv − χ2 (ν) = IG(α = ν/2. Inverse χ2 is a special case of the scaled inverse χ2 -distribution with ν s2 = 1.nu)/theta^2 theta <. . itheta ~ dchisqr(nu) theta ~ ichisq(nu) 2 (ν−2)2 (ν−4) Note: Inverse χ2 is a special case of the inverse gamma-distribution: (rate).DISTRIBUTIONS Table 18.6 Inverse chi-squared density: Inv − χ2 (ν) Model p(θ) = 1 θ−(ν/2+1) e−1/(2θ) Γ(ν/2)2ν/2 4 ν=5 517 Examples Condition: ν > 0 Range: (0.1/itheta. β = 1/2) (rate).

∞) Parameters: α: shape.beta) SAS: (scale) theta ~ igamma(alpha. itheta ~ dgamma(alpha.7 Inverse gamma density: IG(α. β = 1 0 2 4 6 8 θ Moments rate: mean: mode: β β (α−1) Program commands R: (scale) dgamma(1/theta. β) Model rate: p(θ) = 1 β α Γ(α) 518 Examples θ−(α+1) e−β/θ 4 1/scale = β α = 4.iscale=beta) theta ~ igamma(alpha. β = 1) 0 α = 1.alpha.rate=beta)/theta^2 dgamma(1/theta. β = 1 Condition: α > 0.scale=ibeta) variance: β2 (α−1)2 (α−2) Note: θ ∼ IG(α. β > 0 Range: (0. β) ⇔ 1/θ ∼ Gamma(α.scale=beta)/theta^2 β (α+1) WB/JAGS: theta <.DISTRIBUTIONS Table 18.1/itheta.alpha. β). β = 20 1 Gamma(α = 4. . β: rate Density 2 3 α = 20.

sigma) WB/JAGS: (rate) theta ~ ddexp(isigma) SAS: (rate) theta ~ laplace(mu. σ = 1 µ = 7.1 2 4 6 8 10 θ Moments scale: σ mean: mode: µ µ Program commands R: dlaplace(theta.scale=sigma) theta ~ laplace(mu. R function dlaplace is available from R package ‘VGAM’.8 Laplace density: Laplace(µ.2 0. ∞) Parameters: µ: location. σ) Model scale: 1 p(θ) = 2σ e−(θ−µ)/σ Condition: σ > 0 Range: (−∞.6 0.DISTRIBUTIONS Table 18.0 0 0. σ = 1 Density 0.5 µ = 5. σ = 2 0.mu. .4 µ = 4. σ: scale Examples 519 0.3 0.iscale=isigma) variance: 2σ 2 Note: Laplace distribution is also called double exponential distribution.

2 µ = 7.9 Logistic distribution: Logistic(µ.5 Condition: σ > 0 Range: (−∞.0 0. σ = 1 0. σ = 1) µ = 5.mu. σ = 2 0 2 4 6 8 10 θ Moments mean: mode: variance: µ µ π σ 3 2 2 Program commands R: dlogis(theta.sigma) WB/JAGS: theta ~ dlogis(mu. σ) Model p(θ) = ( )[ ( )]2 exp − θ−µ σ exp − θ−µ σ σ Examples 520 0.sigma) .DISTRIBUTIONS Table 18.3 0.4 N(µ = 5. σ = 1 0.isigma) (rate) SAS: theta ~ logistic(mu. ∞) Parameters: µ: location. σ: scale Density 0.1 µ = 4.

∞) Parameters: µ: location.2 µ = 4. σ = 1 0.sd=sigma) theta ~ lognormal(mu.var=sigma2) theta ~ lognormal(mu.7 µ = 0.6 Density µ = 2. σ: scale 0.DISTRIBUTIONS Table 18.10 Lognormal distribution: LN(µ.1 Condition: σ > 0 Range: (0. σ = 1 0. σ = 2 0.3 0.5 0. σ 2 ) Model p(θ) = 1 √ θσ 2π 521 Examples ( ) 2 exp − (log(θ)−µ) 2 2σ 0.sigma) WB/JAGS: theta ~ dlnorm(mu.isigma2) SAS: theta ~ lognormal(mu.0 µ = 0.mu. σ = 2 0 2 4 6 8 10 θ Moments mean: mode: exp(µ + σ 2 ) exp(µ − σ ) 2 Program commands R: dlnorm(theta.prec=isigma2) variance: exp(2(µ + σ 2 )) − exp(2µ + σ 2 ) .4 0.

0 0 0.11 Normal distribution: N(µ.1 2 4 6 8 10 θ Moments mean: mode: µ µ 2 Program commands R: dnorm(theta.4 µ = 5.3 µ = 4. ∞) Parameters: µ: location.DISTRIBUTIONS Table 18.mu. σ = 1 Condition: σ > 0 Range: (−∞.sigma) WB/JAGS: theta ~ dnorm(mu. σ 2 ) Model p(θ) = 1 √ σ 2π 522 Examples ( ) 2 exp − (θ−µ) 2 2σ 0.prec=isigma2) variance: σ .var=sigma2) theta ~ normal(mu.2 0.5 0. σ = 1 µ = 7.sd=sigma) theta ~ normal(mu.isigma2) SAS: theta ~ normal(mu. σ = 2 0. σ: scale Density 0.

(theta-mu)/sigma)/sigma WB/JAGS: theta ~ dt(mu.isigma2. σ = 2 ν = 20.0 Condition: σ > 0.var=sigma2.nu) .3 0.1 0.prec=isigma2.DISTRIBUTIONS Table 18. ν > 0 Range: (−∞.nu) theta ~ t(mu.4 N(µ = 5. σ = 1) (θ−µ)2 νσ 2 0. µ = 5. ∞) Parameters: µ: location. σ = 1 ν = 2.sd=sigma. µ.5 0.12 Location-scale Student’s t-distribution: t(ν.nu) theta ~ t(mu. σ) Model p(θ) = Γ( ν+1 ) 2√ Γ( ν )σ νπ 2 523 Examples ( 1+ )− ν+1 2 0.2 ν = 10. σ = 1 0 2 4 6 8 10 θ Moments mean: mode: variance: µ (if ν > 1) µ ν 2 ν−2 σ Program commands R: dt(nu. µ = 5. µ = 4.nu) (if ν > 2) SAS: theta ~ t(mu. σ: scale ν: degrees of freedom Density 0.

β = 4 α = 1.beta) (if α > 2) SAS: theta ~ pareto(alpha.beta. .13 Pareto distribution: Pareto(α. β: location Density 2 3 1 α = 4. β > 0 Range: (β.DISTRIBUTIONS Table 18.beta) Note: R function dpareto is available from R package ‘VGAM’. β = 1 0 1 2 3 4 5 6 7 8 θ Moments mean: mode: variance: αβ α−1 Program commands (if α > 1) R: dpareto(theta. ∞) Parameters: α: shape. β = 1 Condition: α > 0.alpha) β αβ 2 (α−1)2 (α−2) WB/JAGS: theta ~ dpareto(alpha. β) Model p(θ) = α β 524 Examples ( )α+1 β θ 4 α = 4.

8 ν = 5.nu)nu* s^2/theta^2 theta <. s > 0 Range: (0. s2 ) = IG(α = ν/2.14 Scaled inverse chi-squared density: Inv − χ2 (ν.2 ν = 3. β = ν s2 /2) (rate). s2 = 1 0. itheta ~ dchisqr(nu) theta ~ sichisq(nu.nu*s^2/itheta.4 ν = 3. ∞) Parameters: ν: degrees of freedom.DISTRIBUTIONS Table 18. .s) Note: Scaled inverse chi-squared is a special case of the inverse gamma distribution: Inv − χ2 (ν. s2 ) Model p(θ) = (ν/2)ν/2 ν −(ν/2+1) −νs2 /(2θ) e Γ(ν/2) s θ 0. s2 = 5 0.6 525 Examples Condition: ν > 0. s2 : scale Density 0. s2 = 1 0.0 0 5 10 15 θ Moments mean: mode: variance: ν 2 ν−2 s ν 2 ν+2 s 2ν 2 4 (ν−2)2 (ν−4) s Program commands (ν > 2) R: WB/JAGS: (ν > 4) SAS: dchisq(nu*s^2/theta.

8 0.6 0.0 exp (−(θ/β)α ) α = 1. β > 0 Range: α = 1 : [0.alpha. β) Model p(θ) = α β 526 Examples ( )(α−1) θ β 1.2 0. β = 1 0. β = 1 α = 2. β: scale Density 0.beta)’. β = 4 0 2 4 6 8 10 θ Moments mean: mode: βΓ(1 + 1/α) β(1 − 1/α)1/α (if α > 1) Program commands R: dweibull(theta.0 Condition: α > 0.alpha. β = 2 α = 2. ∞) otherwise : (0.beta) variance: [ ] β 2 Γ(1 + 2/α) − Γ2 (1 + 2/α) Note: SAS: more general Weibull distribution with additional µ > 0 = lower limit of range: ‘weibull(mu.beta) WB/JAGS: theta ~ dweib(alpha.15 Weibull distribution: Weibull(α.alpha.DISTRIBUTIONS Table 18. with θ/β in Weibull distribution replaced by (θ − µ)/β.ibeta) SAS: theta ~ weibull(0. . ∞) Parameters: α: shape.4 α = 2.

alpha.beta) SAS: theta ~ uniform(alpha. β = 5 0 1 2 3 4 5 θ Moments mean: mode: variance: α+β 2 Program commands R: 2 dunif(theta.0 0.6 0.16 Uniform distribution: U(α. β) Model p(θ) = 1 β−α 527 Examples 1.1) = Beta(1.4 0.beta) (β−α) 12 WB/JAGS: theta ~ dunif(alpha.1). β = 2 α = 2.0 α = 1.8 1. β] Parameters: α: lower limit.DISTRIBUTIONS Table 18. β: upper limit Density 0.2 Condition: β > α Range: [α.2 0. .beta) Note: Uniform is a special case of the beta distribution: U(0.

pi) variance: nπ(1 − π) Note: ⌊(n + 1)π⌋ = greatest integer in value.2 0. π = 0. WB: dbern(pi). . Special case: Bernoulli distribution = Bern(π) = Bin(1. 0≤π≤1 Range: θ ∈ {0. 1. .1 2 4 6 8 10 θ Moments mean: mode: nπ ⌊(n + 1)π⌋ Program commands R: dbinom(theta.17 Binomial distribution: Bin(n. .0 0 0. π = 0.1 0.3 n = 10.5 0. 2.n.3 Discrete univariate distributions Table 18. . . Commands Bernoulli dist: R: dbern(pi). π = 0.n) SAS: theta ~ binomial(n. . SAS: binary(pi).π). n} Parameters: n: sample size π: probability of success n = 10. π) Model p(θ) = (n) θ Examples 0.7 Conditions: n = 0. .4 π θ (1 − π)n−θ Distribution n = 10.pi) WB/JAGS: theta ~ dbin(pi. .DISTRIBUTIONS 528 18. 1.

.pi) WB/JAGS: theta ~ dcat(pi) SAS: theta ~ multinom(pi) variance: − Note: Categorical is a special case of the multinomial distribution with n = 1.0 0.2. . . .0. n} Parameters: πθ : class probabilities Distribution 0. πθ = 1 Range: θ ∈ {0.4. 1. JAGS only requires that πθ is positive.0.18 Categorical distribution: Cat(π) Model p(θ) = πθ Conditions: ∑ πθ > 0.1. .4 π= (0.0.0 0.size=1.DISTRIBUTIONS Table 18.3) 0 1 2 3 4 5 θ Moments mean: mode: − − Program commands R: dmultinom(theta. they must not add up to 1.8 529 Examples 1.2 0.6 0.

10 n = 5.n. 2. 1.19 Negative binomial distribution: NB(n. . .n) SAS: theta ~ negbin(n. Expression (6.15): π = β/(1 + β) and n = α a real value. .30 0.DISTRIBUTIONS Table 18. .pi) WB/JAGS: theta ~ dnegbin(pi.7 Conditions: n = 0. n} Parameters: n: number of successes π: probability of success 0. We have seen alternative parametrizations of the negative binomial distribution in the book: Expression (3. .π).00 0 5 10 15 20 θ Moments ( mean: mode: variance: round round n(1−π) π2 Program commands ( n(1−π) π ) ) R: dnegbin(theta. .15 0. π) Model p(θ) = (θ+n−1) θ 530 Examples π n (1 − π)θ Distribution 0. 0≤π≤1 Range: θ ∈ {0.19): π = 1/(1 + κλ) and n = 1/κ a real value. . π = 0.pi) (n−1)(1−π) π Note: Special case: Geometric distribution: geom(p)=NB(1.5 0. π = 0.20 n = 5. 1. π = 0.25 n = 5.2 0.05 0. .

5 0. n} Parameters: λ: average number of counts 0.7 Condition: λ ≥ 0 Range: θ ∈ {0.lambda) WB/JAGS: theta ~ dpois(lambda) SAS: theta ~ poisson(lambda) variance: λ .30 0. 1.DISTRIBUTIONS Table 18. .20 n = 5.25 n = 5. π = 0.2 0.05 0. .10 n = 5. π = 0.15 0.20 Poisson distribution: Poisson(λ) Model p(θ) = λθ θ! 531 Examples exp(−λ) Distribution 0. π = 0. . .00 0 5 10 15 20 θ Moments mean: mode: λ round(λ) Program commands R: dpois(theta.

k > 0 Range: Σ symmetric Parameters: k: degrees of freedom & R: inverse of cov matrix WB/JAGS: SAS: Sigma ~ iwishart(k.DISTRIBUTIONS 532 18. Rinv) c det(R)k/2 det(Σ)−(k+p+1)/2 exp − 1 tr (Σ−1 R) (Rinv=R−1 in MCMCpack) 2 with ( ) ∏p c−1 = 2kp/2 π p(p−1)/4 j=1 Γ k+1−j 2 Condition: R pos deﬁnite. . j=1 θj = 1 Parameters: αj : probabilities Moments mean: αj / j=1 αj ∑ α ( m αm −αj ) ∑ j ∑ ( m αm )2 ( m αm −αj ) ∑J mode: (αj − 1)/ ∑J j=1 αj variances: covariances: − (∑ m αj αk ∑ αm )2 ( m αm +1) Table 18.valpha) WB/JAGS: vtheta[] ~ ddirich(valpha[]) SAS: vtheta ~ dirich(valpha) Condition: αj > 0 (j = 1.22 Inverse Wishart distribution: IW(R.R) Moments mean: R/(k − p − 1) (if k > p + 1) mode: R/(k + p + 1) .4 Multivariate distributions Table 18. J) ∑J Range: θj > 0.21 Dirichlet distribution: Dirichlet(α) Model ∑ Γ( J αj ) ∏J j=1 j=1 Γ(αj ) Program commands ∏J αj −1 j=1 θj p(θ) = R: ddirichlet(vtheta. . k. . . k) Model Program commands p(Σ) = [ ] R: diwish(Sigma.

vmu.]) SAS: vtheta ~ mvn(vmu.. .. Σ) Model p(θ) = (2π)p/2 1 det(Σ)1/2 Program commands ] [ exp − 1 (θ − µ)T Σ−1 (θ − µ) 2 R: mvrnorm(vtheta.θk ! 533 Program commands ∏k j=1 πj j .n) SAS: vtheta ~ multinom(vpi) Condition: ∑k j=1 πj = 1 ∑k Range: θj ∈ {0.S[. n} with j=1 θj = n Parameters: πj : probabilities Moments mean: n·π variances: nπj (1 − πj ) covariances: −nπj πk Table 18. π) Model p(θ) = n! θ1 !θ2 !.S) mode: µ variances: Σjj covariances: Σjk .prob=vpi) WB/JAGS: vtheta[] ~ dmulti(pi[]. .DISTRIBUTIONS Table 18.23 Multinomial distribution: Mult(k.24 Multivariate Normal distribution: Np (µ. .size=n. θ R: dmultinom(theta. .S) (MASS) Condition: Σ positive deﬁnite Range: −∞ < θj < ∞ Parameters: µ: mean vector & Σ: p × p covariance matrix Moments mean: µ WB/JAGS: vtheta[] ~ dmnorm(vmu[].

DISTRIBUTIONS Table 18. ν > 0 Range: −∞ < θj < ∞ Parameters: µ: mean vector Σ: p × p covariance matrix ν: degrees of freedom Moments mean: µ (if ν > 1) ν variances: ν−2 Σjj (if ν > 2) WB/JAGS: vtheta[] ~ dmt(vmu[]. Σ) Model Program commands 534 p(θ) = R: [ ]−(ν+p)/2 1 −1/2 T −1 1 + ν (θ − µ) Σ (θ − µ) c det(Σ) with c = Γ[(ν+p)/2] Γ(ν/2)(kπ)p/2 Condition: Σ positive deﬁnite.].S[.nu) SAS: - mode: µ ν covariances: ν−2 Σjk (if ν > 2) .25 Multivariate Student’s t-distribution: Tν (µ.

Σkl ) = k(rik rjl + ril rjk ) WB/JAGS: Sigma[. Rinv) c det(R)−k/2 det(Σ)(k−p−1)/2 exp − 1 tr (R−1 Σ) (Rinv=R−1 in MCMCpack) 2 with ( ) ∏p c−1 = 2kp/2 π p(p−1)/4 j=1 Γ k+1−j 2 Condition: R pos deﬁnite.DISTRIBUTIONS Table 18.]. k > 0 Range: Σ symmetric Parameters: k: degrees of freedom & R: covariance matrix Moments mean: kR variances: 2 var(Σij ) = k(rij + rii rjj ) mode: (k − p − 1)R (if k > p + 1) covariances: cov(Σij . k. .] ~ dwish(R[.26 Wishart distribution: Wishart(R.k) SAS: - Note: WinBUGS uses an alternative expression of the Wishart distribution: In the above expression R is replaced by R−1 and hence represents a covariance matrix in WinBUGS. k) Model Program commands 535 p(Σ) = [ ] R: dwish(Sigma.

scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->