《OpenBUGS中的常用分布与函数》由会员分享,可在线阅读,更多相关《OpenBUGS中的常用分布与函数(9页珍藏版)》请在金锄头文库上搜索。
1、Appendix I DistributionsContents topDiscrete Univariate BernoulliBinomialCategoricalNegative BinomialPoissonNon-central HypergeometricContinuous Univariate BetaChi-squaredDouble ExponentialExponentialFlatGammaGeneralized Extreme ValueGeneralized FGeneralized GammaGeneralized ParetoGeneric LogLikelih
2、ood DistributionLog-normalLogisticNormalParetoStudent-tUniformWeibullDiscrete Multivariate MultinomialContinuous Multivariate DirichletMultivariate NormalMultivariate Student-t WishartDiscrete Univariatetoptop appendix iBernoullir dbern(p) Binomialr dbin(p, n) Categoricalr dcat(p) Negative Binomialx
3、 dnegbin(p, r) Poissonr dpois(lambda) Non-central Hypergeometricx dhyper(n, m, N, psi)Continuous Univariatetoptop appendix iBetap dbeta(a, b) Chi-squaredx dchisqr(k) Double Exponentialx ddexp(mu, tau) Exponentialx dexp(lambda) Flatx dflat()constant value for all x; not a proper distributionGammax dg
4、amma(r, mu) Generalized Extreme Value x dgev(mu,sigma,eta) Generalized Fx df(n,m,mu,tau)Reduces to the standard F for mu=0, tau=1.Generalized Gammax dggamma(r, mu, beta) Generalized Paretox dgpar(mu,sigma,eta) GenericLogLikelihood distributionx dloglik(lambda) exp(lambda); NB does not depend on x. S
5、ee Generic sampling distributions.Log-normalx dlnorm(mu, tau) Logisticx dlogis(mu, tau) Normalx dnorm(mu, tau) Paretox dpar(alpha, c) Student-tx dt(mu, tau, k) Uniformx dunif(a, b) Weibullx dweib(v, lambda) Discrete Multivariatetoptop appendix iMultinomialx dmulti(p, N) Continuous Multivariatetoptop
6、 appendix iDirichletp ddirich(alpha) May also be speltddirchas in WinBUGS.Multivariate Normalx dmnorm(mu, T,) Multivariate Student-tx dmt(mu, T, k) Wishartx, dwish(R, k) Appendix II Functions and FunctionalsFunction arguments represented by e can be expressions, those by s must be scalar-valued node
7、s in the graph and those represented by v must be vector-valued nodes in a graph. Some function arguments must be stochastic nodes. Functionals are described using a similar notation to functions, the special notation F(x) is used to describe the function on which the functional acts. See example Fu
8、nctionals for details. Systems of ordinary differential equations and their solution can be described in the BUGS language by using the special D(x1:n, t) notation. See example ode for details. Scalar functions topabs(e) absolute value of e, |e|arccos(e) inverse cosine of earccosh(e) inverse hyperbo
9、lic cosine of earcsin(e) inverse sine of earcsinh(e) inverse hyperbolic sine of earctan(e) inverse tangent of earctanh(e) inverse hyperbolic tangent of ecloglog(e) complementary log log of e, ln(-ln(1 - e)cos(e) cosine of ecosh(e) hyperbolic cosine of ecumulative(s1, s2) tail area of distribution of
10、 s1 up to the value of s2, s1 must be stochastic, s1 and s2 can be the same ?cut(e) cuts edges in the graph - see Use of the cut functiondensity(s1, s2) density of distribution of s1 at value of s2, s1 must bea stochastic node supplied as data, s1 and s2 can be the same.deviance(s1, s2) deviance of
11、distribution of s1 at value of s2, s1 must bea stochastic node supplied as data, s1 and s2 can be the same.equals(e1, e2) 1 if value of e1 equals value of e2; 0 otherwiseexp(e) exp(e)gammap(s1, s2) partial (incomplete) gamma function, value of standardgamma density with parameter s1 integrated up to
12、 s2ilogit(e) exp(e)/ (1 + exp(e)icloglog(e) 1 - exp( - exp(e)integral(F(s), s1, s2, s3)definite integral of function F(s) between s = s1 and s = s2to accuracy s3log(e) natural logarithm of elogfact(e) ln(e!)loggam(e) logarithm of gamma function of elogit(e) ln(e/ (1 - e)max(e1, e2) e1 if e1 e2; e2 o
13、therwisemin(e1, e2) e1 if e1 = 0; 0 otherwisetan(e) tangent of etanh(e) hyperbolic tangent of etrunc(e) greatest integer less than or equal to eVector functions topinprod(v1, v2)inner product of v1 and v2,iv1iv2iinterp.lin(e, v1, v2)v2p + (v2p+1 - v2p) * (e - v1p) / (v1p+1 - v1p)where the elements o
14、f v1 are in ascending orderand p is such that v1p e v1p+1.Given function values in the vector v2 evaluated at the points in v1, this estimates the function value at a new point e by simplelinear interpolation using the closest bounding pair of points.For example, given the population in 1991,2001 an
15、d 2011, wemight want to estimate the population in 2004.inverse(v) inverse of symmetric positive-definite matrix vlogdet(v) log of determinant of v for symmetric positive-definite vmean(v) ivi / nn = dim(v)eigen.vals(v) eigenvalues of matrix vode(v1, v2, D(v3, s1), s2, s3)solution of system of ordin
16、ary differential equations at gridof points v2 given initial values v1 at time s2 solvedto accuracy s3. v3 is a vector of components of the systemof ode and s1 is the time variable. See the PDF files in the Diff/Docudirectory of the OpenBUGS installation forfurther details.prod(v) ivip.valueM(v)v must be a multivariate stochastic n