- #1
- 3,499
- 1,054
I have the following silly problem I don't know how to get round
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.
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.