Skip to main content
added 994 characters in body
Source Link
Aaron Meyerowitz
  • 30.1k
  • 1
  • 48
  • 104

I'll assume that your data is discrete.

You can pick a class of function such as $g(x)=Ax+B+C\sin(x+D)$$g(x)=Ax+B+C\sin(Dx+E)$ and then solve for $A,B,C,D$$A,B,C,D,E$ which minimize $\sum(f(x)-g(x))^2$$\sum(f(x)-g(x))^2.$

later thoughts As I think about it, that might not be that easy to solve (at least using partial derivatives, perhaps a multi-dimensional Newtons method but that does not seem worthwhile).

Any modeling is a matter of judgement. I think you would in any case first just find the best linear fit $Ax+B$ (which is easy) and then work on the values $f(x)-(Ax+B).$ Now you have the cleaner problem:

Given something which looks like random noise with mean $0$ how would you model it?

Without any further information I might just find average absolute value $V$ of the error and then add a term $(2-{\sqrt{2}})\frac{V}{2}\sin(Mx+M)$ where $M$ is a huge constant. So this is essentially random sampling from a source with mean value $0$ and mean absolute value $V$. This would be expected (I would think) to be roughly no better or worse a fit to your actual data than the line $Ax+B$ but to have the right amount of noisiness.

You can pick a class of function such as $g(x)=Ax+B+C\sin(x+D)$ and then solve for $A,B,C,D$ which minimize $\sum(f(x)-g(x))^2$

I'll assume that your data is discrete.

You can pick a class of function such as $g(x)=Ax+B+C\sin(Dx+E)$ and then solve for $A,B,C,D,E$ which minimize $\sum(f(x)-g(x))^2.$

later thoughts As I think about it, that might not be that easy to solve (at least using partial derivatives, perhaps a multi-dimensional Newtons method but that does not seem worthwhile).

Any modeling is a matter of judgement. I think you would in any case first just find the best linear fit $Ax+B$ (which is easy) and then work on the values $f(x)-(Ax+B).$ Now you have the cleaner problem:

Given something which looks like random noise with mean $0$ how would you model it?

Without any further information I might just find average absolute value $V$ of the error and then add a term $(2-{\sqrt{2}})\frac{V}{2}\sin(Mx+M)$ where $M$ is a huge constant. So this is essentially random sampling from a source with mean value $0$ and mean absolute value $V$. This would be expected (I would think) to be roughly no better or worse a fit to your actual data than the line $Ax+B$ but to have the right amount of noisiness.

Source Link
Aaron Meyerowitz
  • 30.1k
  • 1
  • 48
  • 104

You can pick a class of function such as $g(x)=Ax+B+C\sin(x+D)$ and then solve for $A,B,C,D$ which minimize $\sum(f(x)-g(x))^2$