r - R:无法使用特征的平方进行线性回归
问题描述
我有下面使用内置数据集的代码mtcars
:
data(mtcars)
model_1 <- lm(mpg ~ wt + log(wt), data = mtcars)
summary(model_1)
model_2 <- lm(mpg ~ wt + wt^2, data = mtcars)
summary(model_2)
在model_1
中,事情运行良好,我有两个特征wt
,log(wt)
在我的回归结果中。
但是在 中model_2
,我只有wt
在结果中,而我没有 的平方wt
。为什么以及如何解决?
解决方案
推荐阅读
- javascript - 未捕获(承诺中)错误:tabs.discard 的参数类型不正确
- angular - 在高图中查找并填充折线图与绘图线的交点
- c++ - 检查 1/n 小数点后是否有无限位数
- rabbitmq - 消息卡在 RabbitMQ 上的 x-delayed-message Exchange 中
- mysql - 在 MYSQL 查询中求和时如何忽略 NULL?
- c# - 有没有办法使用 gecko c# 更改打印边距
- google-sheets - 使用非默认工作表在 BigQuery Cloud Shell 中从 Google 工作表创建外部表
- r - 绘制具有分类预测变量的支持向量机
- xamarin - Xamarin 表单 UWP 的 MasterDetail 页面中的标题问题
- chronicle-map - 创建一个堆外内存 ChronicleMap