csgillespie / poweRlaw

This package implements both the discrete and continuous maximum likelihood estimators for fitting the power-law distribution to data. Additionally, a goodness-of-fit based approach is used to estimate the lower cutoff for the scaling region.
109 stars 24 forks source link

Error in lognormal gof #60

Closed lsaravia closed 8 years ago

lsaravia commented 8 years ago

I am trying to apply the godness of fit to lognormal models but I get this error with several data sets:

Error in checkForRemoteErrors(val) : one node produced an error: vector size cannot be NA In addition: Warning messages: 1: In estimate_xmin(m_cpy, xmins = xmins, pars = pars, xmax = xmax) : Unable to estimate xmin. This may be due to numerical instabilities. For example the parameter estimates are in the distribution tails. 2: In min(which(internal[["dat"]] >= (x - .Machine$double.eps^0.5))) : no non-missing arguments to min; returning Inf

A reproducible example follows,

s<-"0.0129490904 0.0041861513 0.0003067831 0.0041393620 0.0021798185 0.0621797229 0.0604354773 0.0005864411 0.0047533879 0.0037074578 0.0049305052 0.0000409917 0.0073296139 0.0015751700"
dat <- sapply(strsplit(s," "),as.numeric)
model <- conlnorm$new(dat)
model$setPars(estimate_pars(model))

GOF <- bootstrap_p(model,
               xmins=0.00370746,
               pars = NULL, 
               xmax = max(dat),
               no_of_sims = 1000)
csgillespie commented 8 years ago

Thanks. I can reproduce. I intend to devote some time to the package next week. So should have a fix then.