Basic Statistics

Computer Specifications

Assignment 9

mydata <- read.csv("C:\\Users\\RISHI RAHUL\\Desktop\\DS\\16 Basic Statistics\\Level-1\\Computer_Data.csv")

mydata <- mydata[-1]

attach(mydata)
# First Moment Business Decision (Mean, Median, Range)

summary(mydata)
##      price          speed              hd              ram        
##  Min.   : 949   Min.   : 25.00   Min.   :  80.0   Min.   : 2.000  
##  1st Qu.:1794   1st Qu.: 33.00   1st Qu.: 214.0   1st Qu.: 4.000  
##  Median :2144   Median : 50.00   Median : 340.0   Median : 8.000  
##  Mean   :2220   Mean   : 52.01   Mean   : 416.6   Mean   : 8.287  
##  3rd Qu.:2595   3rd Qu.: 66.00   3rd Qu.: 528.0   3rd Qu.: 8.000  
##  Max.   :5399   Max.   :100.00   Max.   :2100.0   Max.   :32.000  
##      screen        cd       multi      premium         ads       
##  Min.   :14.00   no :3351   no :5386   no : 612   Min.   : 39.0  
##  1st Qu.:14.00   yes:2908   yes: 873   yes:5647   1st Qu.:162.5  
##  Median :14.00                                    Median :246.0  
##  Mean   :14.61                                    Mean   :221.3  
##  3rd Qu.:15.00                                    3rd Qu.:275.0  
##  Max.   :17.00                                    Max.   :339.0  
##      trend      
##  Min.   : 1.00  
##  1st Qu.:10.00  
##  Median :16.00  
##  Mean   :15.93  
##  3rd Qu.:21.50  
##  Max.   :35.00
# Second Moment Business Decision (Var, SD)

var(speed)
## [1] 447.6498
sd(price)
## [1] 580.804
# Skewness - Third Moment Business Decision

library(e1071)

skewness(screen)
## [1] 1.633225
# Kurtosis - Fourth Moment Business Decision

kurtosis(ram)
## [1] 1.458699
boxplot(price)

#Boxplot

boxplot(speed, horizontal = TRUE)

# Histogram

hist(ads)

# Plotting the TREND Column data

plot(trend) 

# Scatter plot for the complete Dataset

plot(mydata)

# Correlation

cor(mydata[,1:5])
##            price     speed        hd       ram    screen
## price  1.0000000 0.3009765 0.4302578 0.6227482 0.2960415
## speed  0.3009765 1.0000000 0.3723041 0.2347605 0.1890741
## hd     0.4302578 0.3723041 1.0000000 0.7777263 0.2328015
## ram    0.6227482 0.2347605 0.7777263 1.0000000 0.2089537
## screen 0.2960415 0.1890741 0.2328015 0.2089537 1.0000000
model <- lm(price~speed+hd+ram+screen)
summary(model)
## 
## Call:
## lm(formula = price ~ speed + hd + ram + screen)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1048.21  -297.09   -48.29   214.30  2538.47 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  10.33311   88.22222   0.117    0.907    
## speed         5.24930    0.27836  18.858   <2e-16 ***
## hd           -0.57936    0.03507 -16.520   <2e-16 ***
## ram          76.74545    1.53586  49.969   <2e-16 ***
## screen      105.52592    6.18879  17.051   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 427.5 on 6254 degrees of freedom
## Multiple R-squared:  0.4586, Adjusted R-squared:  0.4583 
## F-statistic:  1325 on 4 and 6254 DF,  p-value: < 2.2e-16
confint(model,level = 0.95)
##                    2.5 %      97.5 %
## (Intercept) -162.6127433 183.2789563
## speed          4.7036118   5.7949871
## hd            -0.6481112  -0.5106089
## ram           73.7346413  79.7562585
## screen        93.3937677 117.6580711
#influence.measures(model)

#predict(model,interval = "predict")
library(mvinfluence)
## Warning: package 'mvinfluence' was built under R version 3.5.1
## Loading required package: car
## Warning: package 'car' was built under R version 3.5.1
## Loading required package: carData
## Loading required package: heplots
## Warning: package 'heplots' was built under R version 3.5.1
influenceIndexPlot(model)

plot(model)