I have some astronomical data that I want to fit a sine wave to.
I want to fit something of the form
y = Asin(Ωt+Φ). I know the period of the sinusoid is equal to a sidereal day. So I know the frequency Ω. So, I just need a way to find out optimal values for A and Φ.
Now, since the period of the sinusoid is so huge and we can track a source only to an extent of about 6 hours, I never get data that would have a full cycle of a sine wave in it. most of the cases I might have only 25 percent of it. In this situation where I don't even have a full cycle, what is the best way to estimate the value of the amplitude and phase of the sinusoid?
So, you have to fit the model $$y=A \sin(\Omega t+\Phi)$$ based on $N$ values $(t_i,y_i)$ . This model is nonlinear with respect to its parameters but, fortunately, you know the value of $\Omega$.
Suppose that you assign a value to parameter $\Phi$; so the model simply write $y=A x$ with $x=\sin(\Omega t+\Phi)$. So, parameter $A$ can immediately be obtained by a linear regression without intercept $$A(\Phi)=\frac{\sum _{i=1}^N x_i y_i}{\sum _{i=1}^N x_i^2} $$ and the corresponding sum of squares $SSQ(\Phi)$ of residuals can be computed. So, you need to find an approximate value of $\Phi$ which minimizes $SSQ$; to do this, the simplest is to generate the plot and visually locate the minimum. At this point, you then know $A$ and $\Phi$ and you can safely start a full nonlinear regression.