On Nov 14, 2011, at 6:11 AM, Michele Mazzucco wrote:

Hello David,

thanks for your answer.
I have done as you told me, however the fit is very poor, much worse than that obtained from using the whole dataset (without upper bound).
Any idea?

Counter questions in the absence of data:

??? Is there a reason from domain specific knowledge and theory to expect that the procedure you are attempting should be correct?

??? Why would you want to exclude data?

??? Why are you not looking for more general tutorials (such as the one by Ricci) rather than asking what is as yet an open-ended question on fitting methods that surely does not admit an answer easily provided on a mailing list?

--
David.



Thanks,
Michele

On Nov 4, 2011, at 8:56 PM, David Winsemius wrote:


On Nov 3, 2011, at 7:54 AM, Michele Mazzucco wrote:

Hi all,

I am trying to fit a distribution to some data about survival times.
I am interested only in a specific interval, e.g., while the data lies in the interval (0,...., 600), I want the best for the interval (0,..., 24).

I have tried both fitdistr (MASS package) and fitdist (from the fitdistrplus package), but I could not get them working, e.g.

fitdistr(left, "weibull", upper=24)
Error in optim(x = c(529L, 528L, 527L, 526L, 525L, 524L, 523L, 522L, 521L, :
L-BFGS-B needs finite values of 'fn'
In addition: Warning message:
In dweibull(x, shape, scale, log) : NaNs produced

Am I doing something wrong?

You didn't supply data to test, but shouldn't you supply a lower bound if you want to fit "weibull"? It is, after all, bounded at 0.

left <- c(529L, 528L, 527L, 526L, 525L, 524L, 523L, 522L, 521L, 50*runif(100))
fitdistr(left, "weibull", upper=24)
Error in optim(x = c(529, 528, 527, 526, 525, 524, 523, 522, 521, 18.3964251773432, :
L-BFGS-B needs finite values of 'fn'
In addition: Warning message:
In dweibull(x, shape, scale, log) : NaNs produced

fitdistr(left, "weibull", upper=24, lower=0.5)
    shape         scale
 0.58195013   24.00000000
( 0.04046087) ( 3.38621367)



Thanks,
Michele


p.s. I have seen similar posts, e.g., http://tolstoy.newcastle.edu.au/R/help/05/02/11558.html , but I am not sure whether I can apply the same approach here.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to