Fitting a lognormal distribution to truncated data in R

后端 未结 1 646
夕颜
夕颜 2021-01-01 04:34

For a brief background, I am insterested in describing a distribution of fire sizes, which is presumed to follow a lognormal distribution (many small fires and few large fir

相关标签:
1条回答
  • 2021-01-01 05:35

    Your data is not censored (that would mean that observations outside the interval are there, but you do not know their exact value) but truncated (those observations have been discarded).

    You just have to provide fitdist with the density and the cumulative distribution function of your truncated distribution.

    library(truncdist)
    dtruncated_log_normal <- function(x, meanlog, sdlog) 
      dtrunc(x, "lnorm", a=.10, b=20, meanlog=meanlog, sdlog=sdlog)
    ptruncated_log_normal <- function(q, meanlog, sdlog) 
      ptrunc(q, "lnorm", a=.10, b=20, meanlog=meanlog, sdlog=sdlog)
    
    library(fitdistrplus)
    fitdist(Dt, "truncated_log_normal", start = list(meanlog=0, sdlog=1))
    # Fitting of the distribution ' truncated_log_normal ' by maximum likelihood 
    # Parameters:
    #           estimate Std. Error
    # meanlog -0.7482085 0.08390333
    # sdlog    1.4232373 0.0668787
    
    0 讨论(0)
提交回复
热议问题