This is the Document for the Regression Assignment
data <- read.csv("C:/Users/Abdul Qudoos/Desktop/Regression Data.csv")
newdata <- read.csv("C:/Users/Abdul Qudoos/Desktop/Vivo.csv")
Structure and Summary of the data
str(data)
## 'data.frame': 80 obs. of 9 variables:
## $ Mobile.Name.and.Model: chr "Samsung Galaxy A53" "Samsung Galaxy A23" "Samsung Galaxy A33" "Samsung Galaxy A13" ...
## $ brand : chr "Samsung" "Samsung" "Samsung" "Samsung" ...
## $ Price_PKR : int 132999 77999 113999 54999 62999 189999 179999 84999 198999 305510 ...
## $ Screen_Size_inch : num 6.5 6.6 6.4 6.6 6.6 6.4 6.4 6.5 6.7 6.8 ...
## $ BatteryLife_mAh : int 5000 5000 5000 5000 5000 4500 4500 5000 5000 5000 ...
## $ Camera_MP : int 64 50 48 50 50 36 36 64 108 108 ...
## $ RAM_GB : int 8 6 8 4 4 8 8 6 8 12 ...
## $ Storage_GB : int 128 128 128 64 128 256 128 128 256 512 ...
## $ ChinesCompany : int 0 0 0 0 0 0 0 0 0 0 ...
summary(data)
## Mobile.Name.and.Model brand Price_PKR Screen_Size_inch
## Length:80 Length:80 Min. : 20999 Min. :4.700
## Class :character Class :character 1st Qu.: 41749 1st Qu.:6.100
## Mode :character Mode :character Median : 67499 Median :6.500
## Mean :142013 Mean :6.389
## 3rd Qu.:164999 3rd Qu.:6.678
## Max. :700000 Max. :7.000
## BatteryLife_mAh Camera_MP RAM_GB Storage_GB
## Min. :1821 Min. : 8.00 Min. : 3.000 Min. : 32.0
## 1st Qu.:4200 1st Qu.: 13.00 1st Qu.: 4.000 1st Qu.:128.0
## Median :4500 Median : 48.00 Median : 6.000 Median :128.0
## Mean :4399 Mean : 39.73 Mean : 6.213 Mean :174.4
## 3rd Qu.:5000 3rd Qu.: 64.00 3rd Qu.: 8.000 3rd Qu.:256.0
## Max. :6000 Max. :108.00 Max. :12.000 Max. :512.0
## ChinesCompany
## Min. :0.00
## 1st Qu.:0.00
## Median :0.00
## Mean :0.25
## 3rd Qu.:0.25
## Max. :1.00
Regression Model
m1 <- lm(data$Price_PKR ~ data$Screen_Size_inch+data$BatteryLife_mAh+data$Camera_MP+data$RAM_GB+data$Storage_GB)
m1
##
## Call:
## lm(formula = data$Price_PKR ~ data$Screen_Size_inch + data$BatteryLife_mAh +
## data$Camera_MP + data$RAM_GB + data$Storage_GB)
##
## Coefficients:
## (Intercept) data$Screen_Size_inch data$BatteryLife_mAh
## 60289.44 35888.43 -61.37
## data$Camera_MP data$RAM_GB data$Storage_GB
## 105.26 -3460.71 801.41
Summary of the model
summary(m1)
##
## Call:
## lm(formula = data$Price_PKR ~ data$Screen_Size_inch + data$BatteryLife_mAh +
## data$Camera_MP + data$RAM_GB + data$Storage_GB)
##
## Residuals:
## Min 1Q Median 3Q Max
## -197992 -57472 -19893 23871 489286
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 60289.44 186228.99 0.324 0.7470
## data$Screen_Size_inch 35888.43 36178.70 0.992 0.3244
## data$BatteryLife_mAh -61.37 21.46 -2.860 0.0055 **
## data$Camera_MP 105.26 845.87 0.124 0.9013
## data$RAM_GB -3460.71 8468.97 -0.409 0.6840
## data$Storage_GB 801.41 115.43 6.943 1.26e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 113100 on 74 degrees of freedom
## Multiple R-squared: 0.5371, Adjusted R-squared: 0.5058
## F-statistic: 17.17 on 5 and 74 DF, p-value: 3.042e-11
Boxplots
boxplot(newdata)