【问题标题】:the reason for p-p plot nonlinarp-p图非线性的原因
【发布时间】:2020-08-14 08:24:23
【问题描述】:

我使用 library(fitdistrplus) 包来拟合数据如下:

set.seed(100)
x1<-rlnorm(500,1,3)
f.x1<-fitdist(x1,distr = "lnorm",method = "mme")
plot(f.x1)

以下是绘图结果: enter image description here

我的问题是:x1的数据其实是用rlnorm生成的,但是拟合后pp图不是那么完美,怎么解释?

谢谢。 光明

【问题讨论】:

    标签: r fitdistrplus


    【解决方案1】:

    我强烈怀疑这是因为矩匹配不是估计参数的好方法。我使用矩匹配重复了您的示例:

    set.seed(100)
    x = rlnorm(500, 1, 3)
    
    library(fitdistrplus)
    f.x<-fitdist(x,distr = "lnorm",method = "mme")
    

    参数估计是:

    > f.x
    Fitting of the distribution ' lnorm ' by matching moments 
    Parameters:
            estimate
    meanlog 3.012574
    sdlog   2.199019
    

    如果我使用最大似然进行拟合:

    ll = function(meanlog, sdlog){
      sum(dlnorm(x, meanlog, sdlog, log = TRUE))
    }
    
    objFun = function(params){
      -ll(params[1], params[2])
    }
    
    optim(c(0, 1), objFun)
    

    然后我得到参数估计

    > optim(c(0, 1), objFun)
    $par
    [1] 0.8861808 3.0118166
    

    我认为您会同意这些值更接近您从中采样的值。所以分位数(和百分点)将更接近经验值。

    【讨论】:

      猜你喜欢
      • 2012-08-30
      • 1970-01-01
      • 2014-12-18
      • 2022-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-09
      相关资源
      最近更新 更多