先上代码
>library(Formula)
>formula <- y ~ a/(1+exp(b*log(x) +c))
>a = 133
>b = 1
>c = -5
>x = c(1:100000)
>Fformula = Formula(formula)
>rFformula = attributes(Fformula)
>fyData = eval(rFformula$rhs[[1]])
>plot(fyData~x,log = "x",col = "RED")
- Formula: class Formula extends the base class formula by allowing for multiple responses and multiple parts of regressors. 也就是说大Formula 是对小formula(即原公式功能的拓展),所以必须得用。
- eval函数: 评估指定式子和返回值计算
- 可以自己查看rFormula内容
还不太会predict直接作图,在学习中
图片,其中x轴已经显示为 log scale