Q7 <- read.csv("D:\\DataScience\\Assignments\\Basic Statistic-1\\Q7.csv")
Q7 <- Q7[-1]
attach(Q7)
summary(Q7)
## drat wt qsec
## Min. :2.760 Min. :1.513 Min. :14.50
## 1st Qu.:3.080 1st Qu.:2.581 1st Qu.:16.89
## Median :3.695 Median :3.325 Median :17.71
## Mean :3.597 Mean :3.217 Mean :17.85
## 3rd Qu.:3.920 3rd Qu.:3.610 3rd Qu.:18.90
## Max. :4.930 Max. :5.424 Max. :22.90
getmode <- function(v) {
uniqv <- unique(v)
uniqv[which.max(tabulate(match(v, uniqv)))]
}
getmode(drat)
## [1] 3.92
getmode(wt)
## [1] 3.44
getmode(qsec)
## [1] 17.02
#Variance For Drat
var(drat)
## [1] 0.2858814
#Variance for Wt
var(wt)
## [1] 0.957379
#Variance for qsec
var(qsec)
## [1] 3.193166
#Standard Deviation for drat
sd(drat)
## [1] 0.5346787
#Standard Deviation for wt
sd(wt)
## [1] 0.9784574
#Standard Deviation for qsec
sd(qsec)
## [1] 1.786943
library(e1071)
#skewness for drat
skewness(drat)
## [1] 0.2659039
#skewness for wt
skewness(wt)
## [1] 0.4231465
#skewness for qsec
skewness(qsec)
## [1] 0.3690453
# kurtosis for drat
kurtosis(drat)
## [1] -0.7147006
#drat having Negative kurtosis
#kurtosis for wt
kurtosis(wt)
## [1] -0.02271075
#drat having Negative kurtosis
#kurtosis for qsec
kurtosis(qsec)
## [1] 0.3351142
#drat having Positive kurtosis
# Basic Plots (BarPlot)
barplot(drat)
barplot(wt)
barplot(qsec)
# Basic Plots-BoxPlot
boxplot(drat, horizontal = TRUE)
boxplot(wt, horizontal = TRUE)
#wt having some outliers
boxplot(qsec, horizontal = TRUE)
#qsec having outliers
# Histogram
hist(drat)
# dist having Positive Skewness
hist(wt)
# wt having Positive Skewness
hist(qsec)
#qsec having Positive Skewness
# Scatter plot for the complete Dataset
plot(Q7)
DataQ9a <- read.csv("D:\\DataScience\\Assignments\\Basic Statistic-1\\Q9_a.csv")
DataQ9A <- DataQ9a[,-1]
attach(DataQ9A)
View(DataQ9A)
summary(DataQ9A)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
var(speed)
## [1] 27.95918
var(dist)
## [1] 664.0608
sd(speed)
## [1] 5.287644
sd(dist)
## [1] 25.76938
skewness(speed)
## [1] -0.1105533
#Speed having Negative Skewness
skewness(dist)
## [1] 0.7591268
#Dist having Positive Skewness
kurtosis(speed)
## [1] -0.6730924
#Speed having Negative Kurtosis
kurtosis(dist)
## [1] 0.1193971
#Dist Having Possitive kurtosis
barplot(speed)
barplot(dist)
boxplot(speed, horizontal = TRUE)
#here maybe there is no outlier
boxplot(dist, horizontal = TRUE)
#dist having outlier
# Histogram
hist(speed)
#negative Skewness
hist(dist)
#positive skewness
# Scatter plot for the complete Dataset
plot(DataQ9A)
DataQ9b <- read.csv("D:\\DataScience\\Assignments\\Basic Statistic-1\\Q9_b.csv")
DataQ9B <- DataQ9b[,-1]
attach(DataQ9B)
`## 1st Moment Business Decision Model
summary(DataQ9B)
## SP WT
## Min. : 99.56 Min. :15.71
## 1st Qu.:113.83 1st Qu.:29.59
## Median :118.21 Median :32.73
## Mean :121.54 Mean :32.41
## 3rd Qu.:126.40 3rd Qu.:37.39
## Max. :169.60 Max. :53.00
getmode(SP)
## [1] 118.289
getmode(WT)
## [1] 28.76206
var(SP)
## [1] 201.113
var(WT)
## [1] 56.14225
sd(SP)
## [1] 14.18143
sd(WT)
## [1] 7.492813
skewness(SP)
## [1] 1.552258
#Positive Skewnwss
skewness(WT)
## [1] -0.5921721
#negative Skewness
kurtosis(SP)
## [1] 2.583072
#positive kurtosis
kurtosis(WT)
## [1] 0.7257402
#Positive Kurtosis
barplot(SP)
barplot(WT)
boxplot(WT, horizontal = TRUE)
#Having Outliers
boxplot(SP, horizontal = TRUE)
#Having Outliers
hist(WT)
#Negative Skewness
hist(SP)
#Positive Skewness
# Scatter plot for the complete Dataset
plot(DataQ9B)
DataQ21A <- read.csv("D:\\DataScience\\Assignments\\Basic Statistic-1\\Cars.csv")
attach(DataQ21A)
## The following objects are masked from DataQ9B:
##
## SP, WT
summary(DataQ21A)
## HP MPG VOL SP
## Min. : 49.0 Min. :12.10 Min. : 50.00 Min. : 99.56
## 1st Qu.: 84.0 1st Qu.:27.86 1st Qu.: 89.00 1st Qu.:113.83
## Median :100.0 Median :35.15 Median :101.00 Median :118.21
## Mean :117.5 Mean :34.42 Mean : 98.77 Mean :121.54
## 3rd Qu.:140.0 3rd Qu.:39.53 3rd Qu.:113.00 3rd Qu.:126.40
## Max. :322.0 Max. :53.70 Max. :160.00 Max. :169.60
## WT
## Min. :15.71
## 1st Qu.:29.59
## Median :32.73
## Mean :32.41
## 3rd Qu.:37.39
## Max. :53.00
var(HP)
## [1] 3261.952
var(SP)
## [1] 201.113
var(MPG)
## [1] 83.38328
var(VOL)
## [1] 497.3568
var(WT)
## [1] 56.14225
sd(HP)
## [1] 57.1135
sd(SP)
## [1] 14.18143
sd(MPG)
## [1] 9.131445
sd(VOL)
## [1] 22.3015
sd(WT)
## [1] 7.492813
skewness(HP)
## [1] 1.653176
skewness(SP)
## [1] 1.552258
skewness(MPG)
## [1] -0.1714104
skewness(VOL)
## [1] -0.5685176
skewness(WT)
## [1] -0.5921721
#MPG,VOL,WT Having Negative Skewness,HP,SP Having Positive skewness
kurtosis(HP)
## [1] 2.567217
kurtosis(SP)
## [1] 2.583072
kurtosis(MPG)
## [1] -0.7054604
kurtosis(VOL)
## [1] 0.6981942
kurtosis(WT)
## [1] 0.7257402
#MPG Having Negative Kurtosis Remaining all are having Positive Kurtosis
barplot(HP)
barplot(SP)
barplot(MPG)
barplot(VOL)
barplot(WT)
boxplot(HP, horizontal = TRUE)
boxplot(SP, horizontal = TRUE)
boxplot(MPG, horizontal = TRUE)
boxplot(VOL, horizontal = TRUE)
boxplot(WT, horizontal = TRUE)
#MPG Not having Outliers Remaining All are Having Outliers
hist(HP)
hist(SP)
hist(MPG)
hist(VOL)
hist(WT)
#MPG,VOL,WT Having Negative Skewness,HP,SP Having Positive skewness
plot(DataQ21A)
qqnorm(DataQ21A$MPG)
qqline(DataQ21A$MPG)
#Based on QQ Plot MPG Data is normally Distributed
wcat <- read.csv("D:\\DataScience\\Assignments\\Basic Statistic-1\\wc-at.csv")
attach(wcat)
summary(wcat)
## Waist AT
## Min. : 63.5 Min. : 11.44
## 1st Qu.: 80.0 1st Qu.: 50.88
## Median : 90.8 Median : 96.54
## Mean : 91.9 Mean :101.89
## 3rd Qu.:104.0 3rd Qu.:137.00
## Max. :121.0 Max. :253.00
var(Waist)
## [1] 183.8496
var(AT)
## [1] 3282.69
sd(Waist)
## [1] 13.55912
sd(AT)
## [1] 57.29476
skewness(Waist)
## [1] 0.130389
skewness(AT)
## [1] 0.5688705
#Both are Having Positive Skewness
kurtosis(Waist)
## [1] -1.141846
kurtosis(AT)
## [1] -0.3760059
#Both Are having Negative Kurtosis
barplot(Waist)
barplot(AT)
boxplot(AT, horizontal = TRUE)
boxplot(Waist, horizontal = TRUE)
# Both are not having Outliers
hist(AT)
hist(Waist)
#Both are Having Positive Skewness
# Scatter plot for the complete Dataset
plot(wcat)
qqnorm(AT)
qqline(AT)
qqnorm(Waist)
qqline(Waist)
#Normally Distibuted