# Weight least squares fitting using standard error of the mean rather than the variance

I have data of the form ($x$, $y$, $dy$), where $x$ is the independent variable, $y$ is the dependent variable, and $dy$ is the standard error of the mean (SEM) for $y$. I intend to do a weighted least-squares fit to this data. This wikipedia article states that the inverse of the variance should be used for the weights.

I know that SEM$^2=\sigma^2/n$, the variance over the number in each sample, but without the number in each sample, I cannot get the variance. Simply using SEM$^2$ seems valid under the assumption that each point has the same sample size. If that assumption breaks down, is there any steps to account for the different $n$'s?

I have seen instances where the fit is weighted using simply $1/\sigma$ and also $1/\sigma^2$ but these are not always explicit as to $\sigma$, if it is the standard deviation or the SEM. Which would apply when? Any references would for added information would be great.

I found that section 15.2 of Numerical Recipes 2nd ed describes performing linear regression of data with measurement error, $\sigma_i$, and uses this to weight the fit.

Either should work as long as it is made clear what is used.