Dear list,

I am getting weired with fitting data with a 1/x-polynomial. Suggest I have
the following data:

x <- c(1,2,3,4,5,6,7)
y <- c(100,20,4,2,1,.3,.1)

I may fit this with a linear model

fit1 = lm(y ~ I(x))

Getting plot out of this model I applied
library(polynom)
pol1 = polynomial(fit1$coefficients)
f1 = as.function(pol1)

plot(x,y)
lines(x, f1(x), col = 2)

Clearly, this model appears insufficient. Therefore I intended to aplly
fit2 = lm(y ~ I(1/x))
pol2 = polynomial(fit2$coefficients)
f2 = as.function(pol2)
lines(x, f2(x), col = 3)

as this would be much more pleasant. However, the second model does not work
at all.


Does anyone know about how to correctly fit an x^-1-polynomial to my data
cloud?


Many thanks in advance,


behelfsadresse

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to