I'm attempting to fit a cumulative Weibull curve to some psychophysics perception data. Basically, we're testing the subject's accuracy at a number of different motion speeds, and attempting to fit the data with an upside-down Weibull (should look like a backwards S shape) in order to accurately determine the subject's threshold.

The form of the equation is:

1 - 0.5*exp((-x/a)^b).

a is the "scale parameter" and b is the "shape parameter".

The reason for the 0.5 is that in psychophysics we assume that the worst a subject can perform, given no information at all, is at chance, or 50%.

Using matlab's nlinfit function, I acquired these estimated parameters: a = -0.8, b = -22. I think that b has to be negative to flip the curve upside down.

The weird thing is that instead of going from 1 to 0 in a smooth cumulative-distribution way, the graph of the function seems to shoots off to oscillate between ∞ and -∞ as you get close to x=1. With other similar parameters (such as a = 1, b = -10), it does similarly crazy things, like start at -∞. This makes no sense to me -- how can the function possibly go above 1 or below 0, when both parameters are negative? Perhaps if a<0 and b>0, I could see how the function could get to +∞, but this isn't the case. Shouldn't these parameters make for 1-(a very small number)? Also, it's not just a general problem with my equation or the graphing tool -- using more reasonable parameters (for example, a=1 b=-5), the graph looks very pretty indeed.

I haven't worked with the versatile Weibull distribution before...Any ideas as to why the function could be behaving this way given these parameters?

Much appreciated, Michaela

  • $\begingroup$ Both $a$ and $b$ should be positive to give a distribution. Your nlfit function is doing you wrong. $\endgroup$
    – deinst
    Jul 19, 2011 at 15:44
  • $\begingroup$ Looking at your non standard distribution, I suspect that you have some data points that do worse than 50% $\endgroup$
    – deinst
    Jul 19, 2011 at 15:47
  • $\begingroup$ Shouldnt $exp((-x/a)^b)$ be $exp(-(x/a)^b)$ instead? $\endgroup$
    – leonbloy
    Jul 19, 2011 at 16:06

1 Answer 1


If your equation is supposed to be the CDF of a Weinbull, it should rather be $$1 - exp(-(x/a)^b)$$

Notice (besides the removed 0.5) that the minus sign position is outside the inside parentheses.

Notice also that both parameters must be positive.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .