I have an experimental data set which I'd like to fit to a polynomial. The data comprise an independent variable, the dependent variable and an uncertainty in the measurement of the latter, for example
2000 0.2084272 0.002067834
2500 0.207078125 0.001037248
3000 0.2054202 0.001959138
3500 0.203488075 0.000328942
4000 0.2013152 0.000646088
4500 0.198933825 0.001375657
5000 0.196375 0.000908696
5500 0.193668575 0.00014721
6000 0.1908432 0.000526976
6500 0.187926325 0.001217318
7000 0.1849442 0.000556495
7500 0.181921875 0.000401883
8000 0.1788832 0.001446992
8500 0.175850825 0.001235017
9000 0.1728462 0.001676249
9500 0.169889575 0.001011735
10000 0.167 0.000326678
(columns x, y, +-y).
I can carry out a polynomial fit using the above with for example
mydata = read.table("example.txt")
model <- lm(V2~V1+I(V1^2)+I(V1^3)+I(V1^4), data = mydata)
but this does not make use of the uncertainty values. How do I inform R that the third column of the data set is an uncertainty and that it should therefore be used in the regression analysis?