【问题标题】:How to find the alpha parameter of beta distribution如何找到 beta 分布的 alpha 参数
【发布时间】:2020-09-09 16:27:23
【问题描述】:

我试图找到给定 beta = 1 的 beta 分布的 alpha 的 MLE 估计。 我尝试使用estimatetools包中的maxlogL,但是g

x <- rbeta(n = 1000, shape1 = 0.7, shape2 = 1)

alpha_hat <- maxlogL(x = x, dist = "dbeta", fixed = list(shape2 = 1), lower = (0), upper = (1), link = list(over = "shape1", fun = "log_link"))
summary(alpha_hat)

对于正态分布,以下计算确实给了我对 sd 的估计。

x <- rnorm(n = 10000, mean = 160, sd = 6)
theta_1 <- maxlogL(x = x, dist = 'dnorm', control = list(trace = 1),link = list(over = "sd", fun = "log_link"),
                 fixed = list(mean = 160))
summary(theta_1)

有人能指出第一段代码中的错误吗?

【问题讨论】:

  • 第一段代码的问题不是很清楚,您的句子似乎由于某种原因被剪裁了“......来自estimatetools包但g”请更新您的问题,以便社区可以更好地帮助您

标签: r mle beta-distribution


【解决方案1】:

我不知道。我会偷懒,用我更熟悉的不同方式来做:

library(bbmle)
m <- mle2(x~dbeta(shape1=exp(loga),shape2=1), 
        data=data.frame(x), start=list(loga=0))
## estimate (back-transformed)
exp(coef(m)) ## 0.6731152
## profile confidence interval (back-transformed)
exp(confint(m))
##     2.5 %    97.5 %
## 0.6322529 0.7157005

设置一个简单的引导函数 ...

bootfun <- function() {
    newx <- sample(x,size=length(x),replace=TRUE)
    newm <- update(m, data=data.frame(x=newx))
    return(coef(newm))
}
set.seed(101)
bootsamp <- replicate(500, bootfun())
exp(quantile(bootsamp, c(0.025, 0.975)))
##      2.5%     97.5% 
## 0.6533478 0.7300200 

事实上,对于这种情况,(非常快的)Wald 置信区间可能很好......

exp(confint(m,method="quad"))
##     2.5 %    97.5 % 
## 0.6462591 0.7315456 

【讨论】:

  • 当我复制你的第一个代码块时,我得到了不同的废话估计广告限制。
  • 我想我忘了求幂了。