x <- c(1, 2, 3, 4, 5)
y <- c(1.2, 3.9, 8.6, 17.4, 26)
er <- c(0.5, 0.8, 0.5, 1.9, 1.2)
fit1 <- nls(y ~ k * x^2,
data = list(x = x, y = y),
start = list(k = 1),
weights = 1 / er^2
)
chiquad_red(fit1)
fit2 <- nls(y ~ k * x^3,
data = list(x = x, y = y),
start = list(k = 1),
weights = 1 / er^2
)
chiquad_red(fit2)
Run the code above in your browser using DataLab