I have a dataset of $N$ points each with some different value $y$ I try to fit the data to the form $a\cos(2\pi t)+b\sin(2\pi t)+c\cos(4\pi t)+d\sin(4\pi t)+e$. When I'm looking at the standard errors in the fitted parameters for $a,b,c,d,e$, they are really, really small. For $a=-11$, the standard error in $a$ is only around $0.03$. This well-determinedness is kind of unsettling and I doubt its correctness.

Should note that my $N$ is fairly large, around 400, and I'm using Mathematica to find standard errors in the fitted parameters (i.e. [ParameterTable]).

How can one compute the errors in the fitted parameters? Are the standard errors for the parameters it? They seem too small to be true.

  • $\begingroup$ Your question is absolutely opaque. One might speak of fitting a function $y = a\cos(2\pi t)+b\sin(2\pi t)+c\cos(4\pi t)+d\sin(4\pi t)+e$ where your sample includes some observed values of $y$ and of $t,$, but you speak of $a_i,$ $i=1,\ldots,N$ without saying whether those are in the role of $y$ or of $t.$ Your question as now written cannot be understood. $\endgroup$ – Michael Hardy Nov 2 '19 at 4:19
  • $\begingroup$ Removed the a's. I just want to say each point has some value. The main point of my question i suppose is how to find the errors in the fitted parameters for a NonlinearModelfit of the said function performed on a dataset? $\endgroup$ – Houndbobsaw Nov 2 '19 at 4:27
  • $\begingroup$ Your question remains incomprehensible. You say "each with some different value $y$", but then nothing called $\text{“}y\text{''}$ appears in what follows. $\endgroup$ – Michael Hardy Nov 2 '19 at 4:46
  • $\begingroup$ Suppose one has $$ y = a\cos(2\pi t) + b \sin(2\pi t)+c\cos(4\pi t)+d\sin(4\pi t)+e. $$ Then data could consist of observed values of $y$ and of $t,$ and one might be able to estimate the coefficients. But if you say you have observed values of $y,$ but not of $t,$ and you write $$ a\cos(2\pi t)+b\sin(2\pi t) + c\cos(4\pi t)+d\sin(4\pi t)+e $$ with no variable called $y,$ then at best we can guess what you mean, and guessing is what I am doing here. $\endgroup$ – Michael Hardy Nov 2 '19 at 4:55
  • 2
    $\begingroup$ Could you tell us why you think that the confidence intervals of the fit parameters are too small? $\endgroup$ – Semoi Nov 2 '19 at 11:13

I don't know how Mathematica calculates the standard errors of a the fit. However, I reckon that the point estimator and its standard deviation is calculated via \begin{align} \hat{{\beta}} &= ({X}^T{X})^{-1} {X}^T {y} \\ %%% \hat{Sd}[\hat{\beta}_j] &=\sqrt{ \hat{\textrm{Cov}}[\hat{{\beta}}]_{jj}} = \hat{\sigma} \cdot \sqrt{\big[({X}^T {X})^{-1}\big]_{jj}} \end{align} where ${X}$ is the design matrix! [Note, that $y$ and $\beta$ are vectors in the upper formulae and the hat indicates an estimate.]

An alternative way to check Mathematic's estimates is to produce fake data, from which you know the correct coefficients. By fitting this fake data you get a feeling whether or not Mathematica is reliable.

  • $\begingroup$ thank you this is exactly what i was asking for. Sorry to all above where the question was unclear. May I ask how exactly does one simulate synthetic data given correct coefficients? $\endgroup$ – Houndbobsaw Nov 3 '19 at 0:28
  • $\begingroup$ Well, you just use your formula and generate normally distributed random numbers for your $e$. $\endgroup$ – Semoi Nov 3 '19 at 9:00

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