【发布时间】:2020-09-10 07:01:47
【问题描述】:
我想用一系列形状参数 theta 绘制大小为 1000 的威布尔样本的似然函数。我使用了标准化的 weibull,因此标度 lambda 为 1。但是输出是水平直线。
n<-1000
lik <- function(theta, x){
K<- length(theta)
n<- length(x)
out<- rep(0,K)
for(k in 1:K){
out[k] <- prod(dweibull(x, shape= theta[k], scale=1))
}
return(out)
}
theta<-seq(0.01, 10, by = 0.01)
x <- rweibull(n, shape= 0.5, scale= 1)
plot(theta, lik(theta, x), type="l", lwd=2)
【问题讨论】:
-
尝试绘制 log0likelihood;
sum(dweibull(x, shape= theta[k], scale=1, log=TRUE))并将 theta 保持在更合理的范围内seq(0.01, 1, by = 0.01) -
@user20650,请发帖作为答案?
标签: r plot statistics weibull