I have the following silly problem I don't know how to get round(adsbygoogle = window.adsbygoogle || []).push({});

I have a set of datapoints, each point has known variance (this is experimental data).

I now want to fit this dataset using a constant, meaning I have an equation y=a, i.e. there is no independent variable.

I also want to know some goodness of fit parameters for my fit, i.e. the standard error and ideally also the R^2 value.

This would obviously be trivial if all the points had the same variance, but I don't know how to handle the fact that I need a weighted fit (presumably with 1/sqrt(variance) as weight for each point)

I do know how to do this for linear fits (Matlab's curve fitting toolbox etc), but Matlab doesn't seem to like fitting to constants. Hence, I might have to do it manually.

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Weighted fit to a constant?

**Physics Forums | Science Articles, Homework Help, Discussion**