General question: How do I fit a model to data when the data points have asymmetric error bars? What is the cost function I use to calculate residuals, and from that, how do I calculate confidence intervals/covariances for the fit parameters?
More specific details: I have data that looks something like
$$ Y \sim B(n, A \sin(2\pi f t + \phi) + O)/n $$
Where $B(n, p)$ is the binomial distribution with $n$ trials and success probability $p$. $A, f, \phi$, and $O$ are considered to be fixed parameters that I am trying to estimate. I sample $Y$ $n$ times for a variety of values of $t$ to get $t/y$ data that I want to curve fit to. I calculate each $y$ data point as the fractional number of successes at each $t$. I use the Wilson Score Interval to calculate asymmetric error bars on the $y$ data points for each $t$. This differs from the naive estimation for the error on the mean for a binomial distribution when $p$ is close to 0 or 1 and the number of trials is small.
When error bars are symmetric I curve fit this data by calculating residuals for each point, weighting by the error for each point. What do I do for the case of asymmetric error bars? I could weight by the average of the upper and lower error bars? I could weight by the upper error bar when the data point is above the model line and the lower error bar when the data point is below the model line but this would give discontinuous residuals..
What's the statistically sound approach here?