[英]How can I induce these two datasets for a linear regression model in R?
For linear regression y_i=ax_i+epsilon.对于线性回归,y_i=ax_i+epsilon。 If I want to let x_i from the dataset
Air.Flow
(represents the rate of operation of the plant) and y_i from stack.loss
(the dependent variable) in R.如果我想让 x_i 来自数据集
Air.Flow
(代表工厂的运行率)和 y_i 来自stack.loss
(因变量)。
How can I input these two datasets in R?如何在 R 中输入这两个数据集?
For example, the code例如,代码
library(BAS)
data(bodyfat)
summary(bodyfat)
is to use data set bodyfat
from the library BAS
.是使用来自库
BAS
数据集bodyfat
。 Is there any library for Air.Flow
and stack.loss
?是否有用于
Air.Flow
和stack.loss
库?
The linear regression is as follows:线性回归如下:
You need to get the data first:您需要先获取数据:
df = datasets::stackloss
lm(df$Air.Flow ~ df$stack.loss)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.