Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.