- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将威 bool 分布调整为一个列表数据。在处理我的点云之后,我得到了每个 1 米高度切片的返回数量的列。例子:
a = matrix(c(7,12,10,10,20,3,15,40,33,57,58,60,79,132,174,201,191,184,115,70,22,2,0),1,23)
colnames(a) <- c(13.5,14.5,15.5,16.5,17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5,25.5,26.5,27.5,28.5,29.5,30.5,31.5,32.5,33.5,34.5,35.5)
barplot(a)
最佳答案
您可以对删失数据进行最大似然。
a = matrix(c(7,12,10,10,20,3,15,40,33,57,58,60,79,132,174,201,191,184,115,70,22,2,0),1,23)
colnames(a) <- c(13.5,14.5,15.5,16.5,17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5,25.5,26.5,27.5,
28.5,29.5,30.5,31.5,32.5,33.5,34.5,35.5)
centers <- as.numeric(colnames(a))
low <- centers - .5
up <- centers + .5
ll.weibullCensored <- function(par, dat){
shape <- par[1]
scale <- par[2]
# Get the probability for each 'bin' and take the log
log.ps <- log(pweibull(up, shape, scale) - pweibull(low, shape, scale))
# Sum the logs of the bin probabilities as many times
# as they should be as dictated by the data
sum(rep(log.ps, dat))
}
# Use optim or any other function to find a set
# of parameters that maximizes the log likelihood
o.optim <- optim(c(9, 28),
ll.weibullCensored,
dat = as.numeric(a),
# this tells it to find max instead of a min
control=list(fnscale=-1))
# Probability of each bin
> ps
[1] 0.0005495886 0.0009989085 0.0017438767 0.0029375471 0.0047912909
[6] 0.0075863200 0.0116800323 0.0174991532 0.0255061344 0.0361186335
[11] 0.0495572085 0.0656015797 0.0832660955 0.1004801353 0.1139855466
[16] 0.1197890284 0.1144657811 0.0971503491 0.0711370586 0.0433654456
[21] 0.0210758647 0.0077516837 0.0020274896
# Density evaluated at the center of the bin
> ps.cent
[1] 0.0005418957 0.0009868040 0.0017254545 0.0029103746 0.0047524364
[6] 0.0075325510 0.0116083397 0.0174078328 0.0253967142 0.0359988789
[11] 0.0494450583 0.0655288551 0.0832789134 0.1006305707 0.1143085230
[16] 0.1202647955 0.1149865305 0.0975322358 0.0712125315 0.0431169222
[21] 0.0206762531 0.0074246320 0.0018651941
# Ratio of the probability and the density
> ps/ps.cent
[1] 1.0141963 1.0122663 1.0106767 1.0093364 1.0081757 1.0071382 1.0061760
[8] 1.0052459 1.0043084 1.0033266 1.0022682 1.0011098 0.9998461 0.9985051
[15] 0.9971745 0.9960440 0.9954712 0.9960845 0.9989402 1.0057639 1.0193271
[22] 1.0440495 1.0870127
关于r - 拟合表格数据的 2 参数威 bool 分布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16379468/
Weibull 分布的更新函数 m(t)与 t = 10给出如下。 我想找到 m(t) 的值.我写了以下r计算代码 m(t) last_term = NULL gamma_k = NULL n = 5
已关闭。这个问题是 off-topic 。目前不接受答案。 想要改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 已关闭12 年前。 Improve th
我目前正在处理一些与单元的安装日期和故障日期相对应的生命周期数据。数据是现场数据,所以我确实有大量的暂停(尚未出现故障的单元)。我想使用 Scipy 统计库对这些数据进行一些 Weibull 分析(例
我目前正在对多项临床试验的生存数据进行荟萃分析。 为此,我使用相同的方法从已发布的分析中获取代码。但是,当使用来自已发布分析的数据运行此代码时,我无法复制他们的结果。事实上,结果无法收敛到任何一种合理
以下是我为威 bool 分布编写的代码,它生成适合威 bool 分布的数据并尝试绘制相同的数据 from scipy import stats import numpy as np import ma
我正在尝试复制 R 的 fitdist()使用 scipy.stats 在 Python 中获得结果(引用,不能修改 R 代码)。结果非常接近但仍然不同(差异处于 Not Acceptable 水平)
我是一名优秀的程序员,十分优秀!