📜  逻辑回归曲线拟合 R - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:12.594000             🧑  作者: Mango

代码示例1
fit = glm(vs ~ hp, data=mtcars, family=binomial)
newdat <- data.frame(hp=seq(min(mtcars$hp), max(mtcars$hp),len=100))
newdat$vs = predict(fit, newdata=newdat, type="response")
plot(vs~hp, data=mtcars, col="red4")
lines(vs ~ hp, newdat, col="green4", lwd=2)