-
Notifications
You must be signed in to change notification settings - Fork 1
/
MMM_MultipleLinearRegression.Rmd
56 lines (34 loc) · 1.32 KB
/
MMM_MultipleLinearRegression.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
title: "MMM_MarketMixModeling_MultipleLinearRegression"
author: "RohitDhankar"
date: "24/05/2020"
output: pdf_document
---
This is sample code for the task being done along with Rohan Mathur = https://github.com/RohanMathur17
https://github.com/digital-cognition-co-in/DigitalCognition/issues/24
```{r}
library(readr)
LungCapData <- read_csv("LungCapData.csv")
attach(LungCapData)
View(LungCapData)
names(LungCapData);head(LungCapData)
#
```
For the Multiple Linear Regression that we are performing the - Dependent Variable == LungCapacity in CC
The Multiple Independent vartiables are == Age() , Height() , Smoke() , Gender() , Caesarean()
We fit initial Linear Regression Model with Two Independent variables == Age() and Height()
```{r}
init_multiple_linear_m <- lm(LungCap_cc ~ Age_years + Height_inches)
#typeof(init_multiple_linear_m) # list
#class(init_multiple_linear_m) # lm - Linear Model
summary(init_multiple_linear_m)
# the - Multiple R-squared: 0.843 -- 84.3% Variability in LUNG CAPACITY can be
# explained by the linear relationship between - Age_years + Height_inches and LUNG CAPACITY
```
CORRELATION seen through SCATTER PLOTS
As seen below the - Height_inches is Positivly Correlated to Lung Capacity
```{r}
plot(LungCap_cc~Height_inches)
```
```{r}
```