第3章 概率分布
试验得到的数据通常呈现一定的规律性,引入随机变量以后,可以将随机数据表达为随机变量的函数。常见的随机变量有离散性随机变量和连续性随机变量两种。
当变量全部可以取得的值是有限个或可列无限多个的时候,称为离散性随机变量;
如果对于随机变量的分布函数,存在非负函数,使得对于任何实数有:
(1)
则称为连续型随机变量。
对应于离散型随机变量和连续型随机变量,有离散型概率分布函数和连续型分布函数。
第一节 概率密度函数
一、基本数学原理
对于离散型概率分布和连续型概率分布,二者的概率密度函数定义有所不同。(1)中的函数称为的概率密度函数。该函数具有以下性质:
(1)
(2);
(3);
(4)若在点处连续,则有。
对于离散型概率分布,则不称其为概率密度函数,而称为概率分布或者分布律。
设离散型随机变量所有可能取的值为,取各个不同可能值的概率,即事件的概率为:,。即称为分布律。具有下面性质:
(1),;
(2);
二、相关函数介绍
概率密度函数的名称采用的形式,这里PDF表示Probability Density Function, distriname是分布的名称,比如正态分布的概率密度函数的名称用函数()计算不同分布的概率分布密度计算函数如下表1所示:
表1:Probability Density Functions
The following functions give the value of the density function with the specified distribution at the value quant, the first argument. Subsequent arguments are the parameters of the distribution. Note the period in each function name.
. (quant, prob) Numeric. Returns the probability that a value from the Bernoulli distribution, with the given probability parameter, will be equal to quant.
. (quant, shape1, shape2) Numeric. Returns the probability density of the beta distribution, with the given shape parameters, at quant.
. (quant, n, prob) Numeric. Returns the probability that the number of successes in n trials, with probability prob of success in each, will be equal to quant. When n is 1, this is the same as .
. (quant1, quant2, corr) Numeric. Returns the probability density of the standard bivariate normal distribution, with the given correlation parameter, at quant1, quant2.
. (quant, loc, scale) Numeric. Returns the probability density of the Cauchy distribution, with the given location and scale parameters, at quant.
. (quant, df) Numeric. Returns the probability density of the chi-square distribution, with df degrees of freedom, at quant.
. (quant, shape) Numeric. Returns the probability density of the exponential distribution, with the given shape parameter, at quant.
. (quant, df1, df2) Numeric. Returns the probability density of the F distribution, with degrees of freedom df1 and df2, at quant.
. (quant, shape, scale) Numeric. Returns the probability density of the gamma distribution, with the given shape and scale parameters, at quant.
. (quant, prob) Numeric. Returns the probability that the number of trials to obtain a success, when the probability of success is given by prob, will be equal to quant.
. (quant, mean, stddev) Numeric. Returns the probability density of the half normal distribution, with specified mean and standard deviation, at quant.
. (quant, total, sample, hits) Numeric. Returns the probability that the number of objects with a specified characteristic, when sample objects are randomly selected from a universe of size total in which hits have the specified characteristic, will be equal to quant.
. (quant, loc, scale) Numeric. Returns the probability density of the inverse Gaussian distribution, with the given location and scale parameters, at quant.
. (quant, mean, scale) Numeric. Returns the probability density of the Laplace distribution, with the specified mean and scale parameters, at quant.
. (quant, mean, scale) Numeric. Returns the probability density of the logistic distribution, with the specified mean and scale parameters, at quant.
. (quant, a, b) Numeric. Returns the probability density of the log-normal distribution, with the specified parameters, at quant.
. (quant, thresh, prob) Numeric. Returns the probability that the number of trials to obtain a success, when the threshold parameter is thresh and the probability of success is given by prob, will be equal to quant.
. (quant, mean, stddev) Numeric. Returns the probability density of the normal distribution, with specified mean and standard deviation, at quant.
. (quant, threshold, shape) Numeric. Returns the probability density of the Pareto distribution, with the specified threshold and shape parameters, at quant.
. (quant, mean) Numeric. Returns the probability that a value from the Poisson distribution, with the specified mean or rate parameter, will be equal to quant.
. (quant, df) Numeric. Returns the probability density of Student's t distribution, with the specified degrees of freedom df, at quant.
. (quant, min, max) Numeric. Returns the probability density of the uniform distribution, with the specified minimum and maximum, at quant.
. (quant, a, b) Numeric. Returns the probability density of the Weibull distribution, with the specified parameters, at quant.
. (quant, shape1, shape2, nc) Numeric. Returns the probability density of the noncentral beta distribution, with the given shape and noncentrality parameters, at quant.
. (quant, df,nc) Numeric. Returns the probability density of the noncentral chi-square distribution, with df degrees of freedom and the specified noncentrality parameter, at quant.
. (quant, df1, df2,nc) Numeric. Returns the probability density of the noncentral F distribution, with degrees of freedom df1 and df2 and noncentrality nc, at quant.
. (quant, df,nc) Numeric. Returns the probability density of the noncentral Student's t distribution, with the specified degrees of freedom df and noncentrality nc, at quant.
三、SPSS实现
可以运用“Compute Variable”对话框计算概率密度函数。在数据编辑器中打开一个数据文件以后,单击“Transform”菜单中“Computer”选项,打开“Compute Variable”对话框就可以。
下面生成处参数为1和1的正态分布的概率密度函数,在Target Variable文本框中输入一个变量名pdfnormal,在Functions列表框中找到函数(),用上面的带箭头的按钮复制到Numeric Expression文本框中,添加参数,1,1.单击OK按纽,在数据编辑器的最后一列添加变量pdfnormal, 数值为.当然,可以用同样的方法生成处参数为2的指数分布的概率密度,数值为 。
也可以用语法命令生成概率密度值,例如,下列语句可以执行上面的要求。
第二节 累加分布函数
一、基本数学原理
对于连续型随机变量,其累加分布函数的定义为:若为随机变量,为任意实数,则函数:
称为的累加分布函数。如果知道的累加分布函数,就知道了落在任何一区间上的概率。累加分布函数具有一些性质:
(1)是不减函数;
(2),并且,
。
(3)
二、相关函数介绍
累加分布函数的名称采用的形式,其中distriname为分布的名称,例如正态分布的累加分布函数用函数()计算。不同分布的累加函数如下表2所示。
表2:Cumulative Distribution Functions
The following functions give the probability that a random variable with the specified distribution will be less than quant, the first argument. Subsequent arguments are the parameters of the distribution. Note the period in each function name.
. (quant, prob). Numeric. Returns the cumulative probability that a value from the Bernoulli distribution, with the given probability parameter, will be less than or equal to quant.
. (quant, shape1, shape2). Numeric. Returns the cumulative probability that a value from the Beta distribution, with the given shape parameters, will be less than quant.
. (quant, n, prob). Numeric. Returns the cumulative probability that the number of successes in n trials, with probability prob of success in each, will be less than or equal to quant. When n is 1, this is the same as .
. (quant1, quant2, corr) Numeric. Returns the cumulative probability that a value from the standard bivariate normal distribution, with the given correlation parameter, will be less than quant1 and quant2.
. (quant, loc, scale). Numeric. Returns the cumulative probability that a value from the Cauchy distribution, with the given location and scale parameters, will be less than quant.
. (quant, df). Numeric. Returns the cumulative probability that a value from the chi-square distribution, with df degrees of freedom, will be less than quant.
. (quant, scale). Numeric. Returns the cumulative probability that a value from the exponential distribution, with the given scale parameter, will be less than quant.
. (quant, df1, df2). Numeric. Returns the cumulative probability that a value from the F distribution, with degrees of freedom df1 and df2, will be less than quant.
. (quant, shape, scale). Numeric. Returns the cumulative probability that a value from the Gamma distribution, with the given shape and scale parameters, will be less than quant.
. (quant, prob). Numeric. Returns the cumulative probability that the number of trials to obtain a success, when the probability of success is given by prob, will be less than or equal to quant.
. (quant, mean, stddev) Numeric. Returns the cumulative probability that a value from the half normal distribution, with specified mean and standard deviation, will be less than quant.
. (quant, total, sample, hits). Numeric. Returns the cumulative probability that the number of objects with a specified characteristic, when sample objects are randomly selected from a universe of size total in which hits have the specified characteristic, will be less than or equal to quant.
. (quant, loc, scale) Numeric. Returns the cumulative probability that a value from the inverse Gaussian distribution, with the given location and scale parameters, will be less than quant.
. (quant, mean, scale). Numeric. Returns the cumulative probability that a value from the Laplace distribution, with the specified mean and scale parameters, will be less than quant.
. (quant, mean, scale). Numeric. Returns the cumulative probability that a value from the logistic distribution, with the specified mean and scale parameters, will be less than quant.
. (quant, a, b). Numeric. Returns the cumulative probability that a value from the log-normal distribution, with the specified parameters, will be less than quant.
. (quant, thresh, prob). Numeric. Returns the cumulative probability that the number of trials to obtain a success, when the threshold parameter is thresh and the probability of success is given by prob, will be less than or equal to quant.
CDFNORM. CDFNORM(zvalue). Numeric. Returns the probability that a random variable with mean 0 and standard deviation 1 would be less than zvalue, which must be numeric.
. (quant, mean, stddev). Numeric. Returns the cumulative probability that a value from the normal distribution, with specified mean and standard deviation, will be less than quant.
. (quant, threshold, shape). Numeric. Returns the cumulative probability that a value from the Pareto distribution, with the specified threshold and shape parameters, will be less than quant.
. (quant, mean). Numeric. Returns the cumulative probability that a value from the Poisson distribution, with the specified mean or rate parameter, will be less than or equal to quant.
. (quant, a, b) Numeric. Returns the cumulative probability that a value from the Studentized maximum modulus, with the specified parameters, will be less than quant.
. (quant, a, b) Numeric. Returns the cumulative probability that a value from the Studentized range statistic, with the specified parameters, will be less than quant.
. (quant, df). Numeric. Returns the cumulative probability that a value from Student's t distribution, with the specified degrees of freedom df, will be less than quant.
. (quant, min, max). Numeric. Returns the cumulative probability that a value from the uniform distribution, with the specified minimum and maximum, will be less than quant.
. (quant, a, b). Numeric. Returns the cumulative probability that a value from the Weibull distribution, with the specified parameters, will be less than quant.
. (quant, shape1, shape2, nc). Numeric. Returns the cumulative probability that a value from the noncentral Beta distribution, with the given shape and noncentrality parameters, will be less than quant.
. (quant, df,nc). Numeric. Returns the cumulative probability that a value from the noncentral chi-square distribution, with df degrees of freedom and the specified noncentrality parameter, will be less than quant.
. (quant, df1, df2,nc). Numeric. Returns the cumulative probability that a value from the noncentral F distribution, with degrees of freedom df1 and df2, and noncentrality nc, will be less than quant.
. (quant, df,nc). Numeric. Returns the cumulative probability that a value from the noncentral Student's t distribution, with the specified degrees of freedom df and noncentrality nc, will be less than quant.
三、SPSS实现
可以用“Compare Variable”对话框计算累加分布函数值,如下图形所示。
也可以运用语法命令实现,如下所示:
第三节 逆累加分布函数
一、基本数学原理
逆累加分布函数是累加分布函数的逆函数,利用逆累加分布函数,可以求得满足给定概率时的随机变量对应的值。
二、相关函数
逆累加函数的名称采用的形式,其中distriname为分布的名称,比如正态分布的逆累加函数用函数()计算。不同的逆累加函数如表3所示:
表3:Inverse Distribution Functions
The following functions give the value in a specified distribution having a cumulative probability equal to prob, the first argument. Subsequent arguments are the parameters of the distribution. Note the period in each function name.
. (prob, shape1, shape2). Numeric. Returns the value from the Beta distribution, with the given shape parameters, for which the cumulative probability is prob.
. (prob, loc, scale). Numeric. Returns the value from the Cauchy distribution, with the given location and scale parameters, for which the cumulative probability is prob.
. (prob, df). Numeric. Returns the value from the chi-square distribution, with the specified degrees of freedom df, for which the cumulative probability is prob. For example, the chi-square value that is significant at the level with 3 degrees of freedom is (,3).
. (p, scale). Numeric. Returns the value of an exponentially decaying variable, with rate of decay scale, for which the cumulative probability is p.
. (prob, df1, df2). Numeric. Returns the value from the F distribution, with the specified degrees of freedom, for which the cumulative probability is prob. For example, the F value that is significant at the level with 3 and 100 degrees of freedom is (,3,100).
. (prob, shape, scale). Numeric. Returns the value from the Gamma distribution, with the specified shape and scale parameters, for which the cumulative probability is prob.
. (prob, mean, stddev) Numeric. Returns the value from the half normal distribution, with the specified mean and standard deviation, for which the cumulative probability is prob.
. (prob, loc, scale) Numeric. Returns the value from the inverse Gaussian distribution, with the given location and scale parameters, for which the cumulative probability is prob.
. (prob, mean, scale). Numeric. Returns the value from the Laplace distribution, with the specified mean and scale parameters, for which the cumulative probability is prob.
. (prob, mean, scale). Numeric. Returns the value from the logistic distribution, with specified mean and scale parameters, for which the cumulative probability is prob.
. (prob, a, b). Numeric. Returns the value from the log-normal distribution, with specified parameters, for which the cumulative probability is prob.
. (prob, mean, stddev). Numeric. Returns the value from the normal distribution, with specified mean and standard deviation, for which the cumulative probability is prob.
. (prob, threshold, shape). Numeric. Returns the value from the Pareto distribution, with specified threshold and scale parameters, for which the cumulative probability is prob.
. (prob, a, b) Numeric. Returns the value from the Studentized maximum modulus, with the specified parameters, for which the cumulative probability is prob.
. (prob, a, b) Numeric. Returns the value from the Studentized range statistic, with the specified parameters, for which the cumulative probability is prob.
. (prob, df). Numeric. Returns the value from Student's t distribution, with specified degrees of freedom df, for which the cumulative probability is prob.
. (prob, min, max). Numeric. Returns the value from the uniform distribution between min and max for which the cumulative probability is prob.
. (prob, a, b). Numeric. Returns the value from the Weibull distribution, with specified parameters, for which the cumulative probability is prob.
PROBIT. PROBIT(prob). Numeric. Returns the value in a standard normal distribution having a cumulative probability equal to prob. The argument prob is a probability greater than 0 and less than 1.
第四节 生成随机数
一、数学原理
生成给定分布的随机数,需要首先生成服从均匀分布的随机数。常用的生成均匀分布的随机数的方法是同余法,其递推公式如下:
给定初始值时,可以迭代均匀随机数,将它们进行正规化(则随机数处于0和1之间)或者极差标准化(则随机数处于-1和1之间),可以得到均匀分布的随机数。
获得均匀的随机数后,可以用多种方法构造基于该随机数的随机变量,常用的方法是反函数法,即利用随机变量的分布函数的反函数来推求随机变量。基本算法表示如下:
·产生均匀分布随机数;
·令,然后返回。
二、相关函数
生成随机数的函数名称采用的形式,其中distriname为分布的名称,比如正态分布的随机数()计算,不同分布的随机数生成函数如表4所示:
表4:Random Variable Functions
The following functions give a random variate from a specified distribution. The arguments are the parameters of the distribution. You can repeat the sequence of pseudo-random numbers by setting a seed in the Preferences dialog box before each sequence. Note the period in each function name.
NORMAL. NORMAL(stddev). Numeric. Returns a normally distributed pseudo-random number from a distribution with mean 0 and standard deviation stddev, which must be a positive number. You can repeat the sequence of pseudo-random numbers by setting a seed in the Random Number Seed dialog box before each sequence.
. (prob). Numeric. Returns a random value from a Bernoulli distribution with the specified probability parameter prob.
. (shape1, shape2). Numeric. Returns a random value from a Beta distribution with specified shape parameters.
. (n, prob). Numeric. Returns a random value from a binomial distribution with specified number of trials and probability parameter.
. (loc, scale). Numeric. Returns a random value from a Cauchy distribution with specified location and scale parameters.
. (df). Numeric. Returns a random value from a chi-square distribution with specified degrees of freedom df.
. (scale). Numeric. Returns a random value from an exponential distribution with specified scale parameter.
. (df1, df2). Numeric. Returns a random value from an F distribution with specified degrees of freedom, df1 and df2.
. (shape, scale). Numeric. Returns a random value from a Gamma distribution with specified shape and scale parameters.
. (prob). Numeric. Returns a random value from a geometric distribution with specified probability parameter.
. (mean, stddev) Numeric. Returns a random value from a half normal distribution with the specified mean and standard deviation.
. (total, sample, hits). Numeric. Returns a random value from a hypergeometric distribution with specified parameters.
. (loc, scale) Numeric. Returns a random value from an inverse Gaussian distribution with the specified location and scale parameters.
. (mean, scale). Numeric. Returns a random value from a Laplace distribution with specified mean and scale parameters.
. (mean, scale). Numeric. Returns a random value from a logistic distribution with specified mean and scale parameters.
. (a, b). Numeric. Returns a random value from a log-normal distribution with specified parameters.
. (threshold, shape). Numeric. Returns a random value from a Pareto distribution with specified threshold and shape parameters.
. (mean). Numeric. Returns a random value from a Poisson distribution with specified mean/rate parameter.
. (df). Numeric. Returns a random value from a Student's t distribution with specified degrees of freedom df.
. (min, max). Numeric. Returns a random value from a uniform distribution with specified minimum and maximum. See also the UNIFORM function.
WEIBULL. (a, b). Numeric. Returns a random value from a Weibull distribution with specified parameters.
UNIFORM. UNIFORM(max). Numeric. Returns a uniformly distributed pseudo-random number between 0 and the argument max, which must be numeric (but can be negative). You can repeat the sequence of pseudo-random numbers by setting the same Random Number Seed (available in the Transform menu). before each sequence.
三、SPSS实现
可以运用“Compute Variable”对话框计算服从不同分布函数的随机数。在数据编辑器中打开一个数据文件以后,单击“Transform”菜单中“Computer”选项,打开“Compute Variable”对话框就可以。
同样,也可以计算服从形状参数为2的指数分布的随机数,保存到ranexp变量中,生成的随机数添加到数据编辑器。随机数的个数与当前数据编辑器的个案数相同。如下可以得到随机数。
PAGE
PAGE 2