mle(stats4)
mle()所属R语言包:stats4
Maximum Likelihood Estimation
最大似然估计
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Estimate parameters by the method of maximum likelihood.
最大似然法估计参数。
用法----------Usage----------
mle(minuslogl, start = formals(minuslogl), method = "BFGS",
fixed = list(), nobs, ...)
参数----------Arguments----------
参数:minuslogl
Function to calculate negative log-likelihood.
函数来计算的负对数似然。
参数:start
Named list. Initial values for optimizer.
命名列表。优化的初始值。
参数:method
Optimization method to use. See optim.
优化方法使用。看到optim。
参数:fixed
Named list. Parameter values to keep fixed during optimization.
命名列表。在优化过程中参数值保持固定。
参数:nobs
optional integer: the number of observations, to be used for e.g. computing BIC.
可选的整数,如使用的若干意见计算BIC。
参数:...
Further arguments to pass to optim.
进一步的参数传递optim。
Details
详情----------Details----------
The optim optimizer is used to find the minimum of the negative log-likelihood. An approximate covariance matrix for the parameters is obtained by inverting the Hessian matrix at the optimum.
optim优化是用来寻找最低的负对数似然。反相Hessian矩阵得到的最佳参数近似的协方差矩阵。
值----------Value----------
An object of class mle-class.
对象类mle-class。
注意----------Note----------
Be careful to note that the argument is -log L (not -2 log L). It is for the user to ensure that the likelihood is correct, and that asymptotic likelihood inference is valid.
要小心,要注意该参数是日志的L(不-2日志升)。它是为用户,以确保可能是正确的,并且是有效的,渐进的可能性推理。
参见----------See Also----------
mle-class
mle-class
举例----------Examples----------
## Avoid printing to unwarranted accuracy[#避免不必要的精度的印刷]
od <- options(digits = 5)
x <- 0:10
y <- c(26, 17, 13, 12, 20, 5, 9, 8, 5, 4, 8)
## Easy one-dimensional MLE:[#简单的一维的MLE:]
nLL <- function(lambda) -sum(stats::dpois(y, lambda, log=TRUE))
fit0 <- mle(nLL, start = list(lambda = 5), nobs = NROW(y))
# For 1D, this is preferable:[1D,这是最好的:]
fit1 <- mle(nLL, start = list(lambda = 5), nobs = NROW(y),
method = "Brent", lower = 1, upper = 20)
stopifnot(nobs(fit0) == length(y))
## This needs a constrained parameter space: most methods will accept NA[这需要一个受限参数空间:大多数方法将接受不适用]
ll <- function(ymax = 15, xhalf = 6) {
if(ymax > 0 && xhalf > 0)
-sum(stats::dpois(y, lambda = ymax/(1+x/xhalf), log = TRUE))
else NA
}
(fit <- mle(ll, nobs = length(y)))
mle(ll, fixed = list(xhalf = 6))
## alternative using bounds on optimization[#替代使用范围优化]
ll2 <- function(ymax = 15, xhalf = 6)
-sum(stats::dpois(y, lambda=ymax/(1+x/xhalf), log = TRUE))
mle(ll2, method = "L-BFGS-B", lower = rep(0, 2))
AIC(fit)
BIC(fit)
summary(fit)
logLik(fit)
vcov(fit)
plot(profile(fit), absVal = FALSE)
confint(fit)
## Use bounded optimization[#使用范围内的优化。]
## The lower bounds are really > 0,[#下界是真的> 0,]
## but we use >=0 to stress-test profiling[#但我们使用> = 0,应力测试分析]
(fit2 <- mle(ll, method = "L-BFGS-B", lower = c(0, 0)))
plot(profile(fit2), absVal=FALSE)
## a better parametrization:[#更好的参数化:]
ll3 <- function(lymax = log(15), lxhalf = log(6))
-sum(stats::dpois(y, lambda=exp(lymax)/(1+x/exp(lxhalf)), log=TRUE))
(fit3 <- mle(ll3))
plot(profile(fit3), absVal = FALSE)
exp(confint(fit3))
options(od)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|