开始使用免费开始使用

手动计算预测值

与简单线性回归一样,您可以根据模型系数手动计算预测值。对于平行斜率回归,唯一的变化是:分类自变量的每个类别都有不同的截距。这意味着您需要分别考虑每个类别出现时的情况。

taiwan_real_estatemdl_price_vs_bothexplanatory_data 已可用;已加载 dplyr

本练习是课程的一部分

R 中级回归

查看课程

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Get the coefficients from mdl_price_vs_both
coeffs <- ___

# Extract the slope coefficient
slope <- ___

# Extract the intercept coefficient for 0 to 15
intercept_0_15 <- ___

# Extract the intercept coefficient for 15 to 30
intercept_15_30 <- ___

# Extract the intercept coefficient for 30 to 45
intercept_30_45 <- ___
编辑并运行代码