It has been a while since I have done some stats, and I have tried to fit a curve using optimize.curve_fit of parameter estimation. I am also interested in the standard deviation of the fitted parameters which I get from the square of the diagonal terms of the covariance matrix. In order to get the estandar deviation I need that the number of data being greater than the number of parameter to fit.

My question is following: Why should be the number of data greater (>) than the number of parameters to fit, and not greater or equal (>=)?

Probably is something quite simple, sorry. I suspect that it might have something to do with the degrees of freedom minus one, but not really sure why.


Best regards Dani

  • 1
    $\begingroup$ It doesn't have to be. Where did you read that it does? $\endgroup$ Apr 7, 2022 at 18:09
  • $\begingroup$ I think it is in the code, If I remember well, between line 813 and 834 of minpack.py $\endgroup$
    – Daniel
    Apr 20, 2022 at 10:26
  • $\begingroup$ I think some random comment in a software package does not count as a normative statement :-) $\endgroup$ Apr 20, 2022 at 19:37
  • $\begingroup$ Totally true. I will rephrase the title. $\endgroup$
    – Daniel
    Apr 21, 2022 at 8:16

1 Answer 1


Assuming that everything, individual parameters and function values in $$y_k=f(x,p), ~~~p=(p_1,...,p_d),$$ is scalar, each data point gives one equation $$y_k=f(x_k,p), ~~~k=1,...,N.$$ If you have as much equations as parameters, $N=d$, then in the optimal case you get a locally unique solution for $p$. That means that all equations are satisfied exactly (within floating point accuracy). There is no non-trivial residual error for which one can compute an error model.

So for something meaningful to happen in the variations, one will need substantially more data points than there are parameters to fit.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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