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

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

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

                                         Maximum-likelihood Fitting of Univariate Distributions
                                         单变量分布拟合最大似然

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

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

Maximum-likelihood fitting of univariate distributions, allowing parameters to be held fixed if desired.
最大似然拟合单变量的分布,使参数如果需要固定。


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


fitdistr(x, densfun, start, ...)



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

参数:x
A numeric vector of length at least one containing only finite values.  
数值向量的长度至少有一个只包含有限的值。


参数:densfun
Either a character string or a function returning a density evaluated at its first argument.  Distributions "beta", "cauchy", "chi-squared", "exponential", "f", "gamma", "geometric", "log-normal", "lognormal", "logistic", "negative binomial", "normal", "Poisson", "t" and "weibull" are recognised, case being ignored.  
无论是字符串或一个函数返回在其第一个参数计算密度。分布"beta","cauchy","chi-squared","exponential","f","gamma","geometric","log-normal", "lognormal","logistic","negative binomial","normal","Poisson","t"和"weibull"确认,情况被忽视。


参数:start
A named list giving the parameters to be optimized with initial values.  This can be omitted for some of the named distributions and must be for others (see Details).  
命名列表,给出优化初始值的参数。这可以省略一些命名的分布,必须为他人(见详情)。


参数:...
Additional parameters, either for densfun or for optim. In particular, it can be used to specify bounds via lower or upper or both.  If arguments of densfun (or the density function corresponding to a character-string specification) are included they will be held fixed.  </table>
额外的参数,可以为densfun或optim。特别是,它可以用来指定通过lower或upper或两者的界限。如果densfun(或密度函数对应一个字符字符串规范)的参数包括他们将于固定。 </ TABLE>


Details

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

For the Normal, log-Normal, geometric, exponential and Poisson distributions the closed-form MLEs (and exact standard errors) are used, and start should not be supplied.
为正常,对数正态分布,几何,指数和泊松分布的封闭形式的MLE(和精确的标准误差),start不应提供。

For all other distributions, direct optimization of the log-likelihood is performed using optim.  The estimated standard errors are taken from the observed information matrix, calculated by a numerical approximation.  For one-dimensional problems the Nelder-Mead method is used and for multi-dimensional problems the BFGS method, unless arguments named lower or upper are supplied (when L-BFGS-B is used) or method is supplied explicitly.
对于所有其他的分布,对数似然的直接优化执行使用optim。估计标准误差是从观察到的信息矩阵计算,数值逼近。一维问题内尔德米德方法用于多维问题的BFGS方法,除非参数名为lower或upper时L-BFGS-B)(或 method提供明确。

For the "t" named distribution the density is taken to be the location-scale family with location m and scale s.
对于"t"命名的分布密度与位置m和规模s的位置,规模家庭。

For the following named distributions, reasonable starting values will be computed if start is omitted or only partially specified: "cauchy", "gamma", "logistic", "negative binomial" (parametrized by mu and size), "t" and "weibull".  Note that these starting values may not be good enough if the fit is poor: in particular they are not resistant to outliers unless the fitted distribution is long-tailed.
以下命名的分布,合理的初始值将如果start省略或仅部分指定的:"cauchy","gamma","logistic","negative binomial"(参数化计算mu和size)"t"和"weibull"。请注意,这些启动值可能不够好,如果合适的是穷人,特别是不抗离群,除非拟合分布的长尾。

There are print, coef, vcov and logLik methods for class "fitdistr".
有print,coef,vcov和logLik类"fitdistr"方法。


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

An object of class "fitdistr", a list with four components,
一个对象的类"fitdistr",四个组成部分的列表,


参数:estimate
the parameter estimates,
参数估计,


参数:sd
the estimated standard errors,
估计标准误差,


参数:vcov
the estimated variance-covariance matrix, and
估计协方差矩阵,


参数:loglik
the log-likelihood.
日志的可能性。


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

Numerical optimization cannot work miracles: please note the comments in optim on scaling data.  If the fitted parameters are far away from one, consider re-fitting specifying the control parameter parscale.
数值优化不能创造奇迹:请注意optim缩放数据的意见。如果是从一个遥远的拟合参数,考虑重新装修,指定控制参数parscale。


参考文献----------References----------

Modern Applied Statistics with S. Fourth edition.  Springer.

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


## avoid spurious accuracy[#避免虚假的准确性。]
op <- options(digits = 3)
set.seed(123)
x <- rgamma(100, shape = 5, rate = 0.1)
fitdistr(x, "gamma")
## now do this directly with more control.[#现在直接这样做更多的控制权。]
fitdistr(x, dgamma, list(shape = 1, rate = 0.1), lower = 0.001)

set.seed(123)
x2 <- rt(250, df = 9)
fitdistr(x2, "t", df = 9)
## allow df to vary: not a very good idea![#允许DF有所不同:不是一个非常好的主意!]
fitdistr(x2, "t")
## now do fixed-df fit directly with more control.[#现在不固定DF适合直接与更多的控制。]
mydt <- function(x, m, s, df) dt((x-m)/s, df)/s
fitdistr(x2, mydt, list(m = 0, s = 1), df = 9, lower = c(-Inf, 0))

set.seed(123)
x3 <- rweibull(100, shape = 4, scale = 100)
fitdistr(x3, "weibull")

set.seed(123)
x4 <- rnegbin(500, mu = 5, theta = 4)
fitdistr(x4, "Negative Binomial")
options(op)

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-24 21:09 , Processed in 0.032677 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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