找回密码
 注册
查看: 4886|回复: 0

R语言:Multinom()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 21:38:42 | 显示全部楼层 |阅读模式
Multinom(stats)
Multinom()所属R语言包:stats

                                        The Multinomial Distribution
                                         多项分布

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Generate multinomially distributed random number vectors and compute multinomial probabilities.
产生multinomially分布的随机数向量和计算多项式的概率。


用法----------Usage----------


rmultinom(n, size, prob)
dmultinom(x, size = NULL, prob, log = FALSE)



参数----------Arguments----------

参数:x
vector of length K of integers in 0:size.
向量的长度K整数0:size。


参数:n
number of random vectors to draw.
随机向量绘制的数量。


参数:size
integer, say N, specifying the total number of objects that are put into K boxes in the typical multinomial experiment. For dmultinom, it defaults to sum(x).
整数,说N,指定成K箱典型的多项实验对象的总数。为dmultinom,它默认为sum(x)。


参数:prob
numeric non-negative vector of length K, specifying the probability for the K classes; is internally normalized to sum 1.
数字非负向量长度K指定K类的概率;内部规范化总结1。


参数:log
logical; if TRUE, log probabilities are computed.
逻辑;如果为TRUE,日志概率计算。


Details

详情----------Details----------

If x is a $K$-component vector, dmultinom(x, prob) is the probability
x如果$ K $组件向量,dmultinom(x, prob)的概率是

where C is the "multinomial coefficient" C = N! / (x[1]! * &hellip; * x[K]!) and N = sum(j=1, &hellip;, K) x[j]. <br> By definition, each component X[j] is binomially distributed as Bin(size, prob[j]) for j = 1, &hellip;, K.
其中C是C = N! / (x[1]! * &hellip; * x[K]!)“多项式系数”和N = sum(j=1, &hellip;, K) x[j]。参考根据定义,每个组件X[j]binomially分布Bin(size, prob[j])j = 1, &hellip;, K。

The rmultinom() algorithm draws binomials X[j] from Bin(n[j], P[j]) sequentially, where n[1] = N (N := size), P[1] = p[1] (p is prob scaled to sum 1), and for j &ge; 2, recursively, n[j] = N - sum(k=1, &hellip;, j-1) X[k] and P[j] = p[j] / (1 - sum(p[1j-1)])).
rmultinom()算法绘制二项式X[j]从Bin(n[j], P[j])顺序,其中n[1] = N(N =size)P[1] = p[1](p prob缩放总结1),j &ge; 2,递归,n[j] = N - sum(k=1, &hellip;, j-1) X[k]和P[j] = p[j] / (1 - sum(p[1j-1)]))。


值----------Value----------

For rmultinom(), an integer K x n matrix where each column is a random vector generated according to the desired multinomial law, and hence summing to size.  Whereas the transposed result would seem more natural at first, the returned matrix is more efficient because of columnwise storage.
rmultinom(),K x n整数size矩阵,其中每列是根据所需的多项法律产生一个随机向量,因此总结。而换位的结果起初似乎更自然,返回矩阵是因为按列存储更高效。


注意----------Note----------

dmultinom is currently not vectorized at all and has no C interface (API); this may be amended in the future.
dmultinom目前没有量化,所有有没有C接口(API),这可能会在未来的修订。


参见----------See Also----------

Distributions for standard distributions, including dbinom which is a special case conceptually.
分布为标准的分布,包括dbinom这是一个特殊的情况下,概念。


举例----------Examples----------


rmultinom(10, size = 12, prob=c(0.1,0.2,0.8))

pr &lt;- c(1,3,6,10) # normalization not necessary for generation[正常化不是必要的一代]
rmultinom(10, 20, prob = pr)

## all possible outcomes of Multinom(N = 3, K = 3)[#所有的Multinom的可能结果(n = 3,k = 3)]
X <- t(as.matrix(expand.grid(0:3, 0:3))); X <- X[, colSums(X) <= 3]
X <- rbind(X, 3:3 - colSums(X)); dimnames(X) <- list(letters[1:3], NULL)
X
round(apply(X, 2, function(x) dmultinom(x, prob = c(1,2,5))), 3)

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-5-8 02:51 , Processed in 0.019908 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表