Using predict to find values of non-linear model

前端 未结 1 994
孤独总比滥情好
孤独总比滥情好 2020-12-16 06:05

I\'m trying the next code to try to see if predict can help me to find the values of the dependent variable for a polynomial of order 2, in this case it is obvious y=x^2:

相关标签:
1条回答
  • 2020-12-16 06:51

    If you read the help for predict.lm, you will see that it takes a number of arguments including newdata

    newdata -- An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.

    predict(mypol, newdata = data.frame(x=7))
    
    0 讨论(0)
提交回复
热议问题