0 votes
in R Programming by (330 points)

I am working with this data set: 

u <- c(31,63,95,117,127,143,151.5,157)  

v <- c(98.5,103.8,107.5,101,85,63,34.3,14)

I want to fit a model to these data so that u = f(v). I want it to be a 3rd order polynomial model.

How can I do that in R?

Additionally, can R help me to find the best fitting model?

1 Answer

+2 votes
by (10.9k points)
edited by

To get a third order polynomial in x -

model<- lm(v~ poly(u,3))


model<- lm(v~ u+ I(u^2) + I(u^3))

poly(u,3) is preferable.

Hope this answer helps.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !