r - 你如何绘制线性回归线?
问题描述
如何使用基数 R 将线性回归线拟合到散点图?假设您已经拥有线性模型的摘要信息。
a
我已经有一个比较和的散点图ix
,我正在尝试将回归线lm.a
和添加lm.b
到图中。我应该使用ab线还是其他东西?
a <- c(21, 23, 25, 27, 29)
ix <- c(100, 300, 500, 600, 750)
ib <- c(0, 1, 0, 1, 1)
x <- data.frame(a, ix, ib)
lm.a <- with(x, lm(a ~ ix + ib + ix*ib))
summary(lm.a)
n1 <- lm.a$coefficients[1]
n2 <- lm.a$coefficients[2]
n3 <- lm.a$coefficients[3]
n4 <- lm.a$coefficients[4]
解决方案
推荐阅读
- facebook - Facebook Pixel Error OAuth "Facebook Platform" "invalid_token" "验证访问令牌时出错:用户尚未授权应用程序
- javascript - 出现错误 - 错误:在 .env.local 文件中写入 EPIPE
- jquery - 使用 JQuery 到 wordpress 管理页面 wp-admin
- javascript - 跨域请求被阻止:同源策略不允许读取位于 ... 的远程资源:CORS 标头“Access-Control-Allow-Origin”缺失
- uart - Raspberry Pi4 Uart 接收缓冲区溢出
- php - Apache 缺少授权标头
- verilog - Icarus Verilog 警告 $readmemh:标准不一致,1364-2005 之后
- mysql - 如何通过 created_at 对一组行进行排序?
- reactjs - 地图实例的 React-leaflet v3 和 Leaflet-contextmenu 插件问题
- linux - 从二进制文件 ubuntu 18.04 构建 ninja