当前位置:网站首页>R语言 —— 多元线性回归
R语言 —— 多元线性回归
2022-08-02 03:29:00 【clarkjs】
一、模型简介
一元线性回归是一个主要影响因素作为自变量来解释因变量的变化,在现实问题研究中,因变量的变化往往受几个重要因素的影响,此时就需要用两个或两个以上的影响因素作为自变量来解释因变量的变化,这就是多元回归亦称多重回归。当多个自变量与因变量之间是线性关系时,所进行的回归分析就是多元线性回归。
二、求解过程
这里我使用的数据是包里面自带的数据,我们导入并进行查看:
可以看到第一列是我们的数据标签(无数学含义),后面五列分别为对应的五个特征即相应的数值。我的任务是使用后四个变量来拟合第一个变量"Murder"
在进行多元线性回归之前,通常需要对变量进行相关性分析,例如:我们想用x, y 两个变量来拟合变量 z, 如果x, y相关性过强,则我们只需要其中一个变量就可以拟合z,这就是我们学的多重共线性。因此,我使用 cor 函数查看相关性,如下图所示:
由于相关性矩阵并不直观,因此我使用散点矩阵图来可视化此关系,R语言代码及可视化结果如下(其中我使用了smoother平滑方法):
边栏推荐
- GM7150 CVBS转BT656视频解码芯片详细内容及设计要求
- 《scala 编程(第3版)》学习笔记3
- 【nRF24L01 与 Arduino 连接实现无线通信】
- Comparative analysis of OneNET Studio and IoT Studio
- 【Popular Science Post】Detailed explanation of MDIO interface
- 案例|工业物联网解决方案·智慧钢厂高性能安全数采
- 简单的RC滤波电路
- umi3 权限路由PrivateRoute未执行
- How to quickly build your own IoT platform?
- whistle 手机调试代理工具
猜你喜欢

Typora use
![[Arduino connected to GPS module (NEO-6M) to read positioning data]](/img/16/30ce36f4c11f285d42473d0fec91f0.png)
[Arduino connected to GPS module (NEO-6M) to read positioning data]

Vision Transformer(ViT)论文精读和Pytorch实现代码解析

机器学习预备知识

VCA821可变增益放大器

蓝桥杯:国二选手经验贴 附蓝桥杯历年真题

Arduino lights up nixie tubes

与TI的lvds芯片兼容-GM8284DD,GM8285C,GM8913,GM8914,GM8905C,GM8906C,国腾振芯LVDS类芯片,
![[Arduino uses a rotary encoder module]](/img/2a/43ffe782d6d5aa9f38f875bb5d98b1.png)
[Arduino uses a rotary encoder module]
![[Arduino connects the clock module to display the time on LCD1602]](/img/88/5baac76a24924d1cfd675ff5da830e.png)
[Arduino connects the clock module to display the time on LCD1602]
随机推荐
[Arduino connects the clock module to display the time on LCD1602]
《scala 编程(第3版)》学习笔记4
PAT甲级:1020 Tree Traversals
单火线开关设计详解
Scala,Spark依赖jar包冲突解决方法
《scala 编程(第3版)》学习笔记3
Two-Stream Convolutional Networks for Action Recognition in Videos双流网络论文精读
[Arduino connected to GP2Y1014AU0F dust sensor]
Type c PD 电路设计
兼容C51与STM32的Keil5安装方法
Modify hosts file using batch script
从Attention到Self-Attention和Multi-Head Attention
【科普贴】I2C接口详解——偏硬件解析
uniCloud使用
【Arduino connects DHT11 humidity and temperature sensor】
中国大陆开源镜像站汇总
聊一聊数据库的行存与列存
《scala 编程(第3版)》学习笔记2
研发过程中的文档管理与工具
NE5532运放加法器