In: Math
#Removing all the variables and libraries
rm(list=ls())
#Loading the required library UsingR
#You can install it using install.packages("UsingR")
library(UsingR)
# We will verify the normality using quantile plot and density
plot.
# Loading the dataset
OBP[1:10]
youngdm01 velarra01 tynerja01 thompry01 selbybi01 riverru01
matosju01 maciajo01
0.3287037 0.3246753 0.2485876 0.2945205 0.2784091 0.3021978
0.2791878 0.2943548
maciajo01 lopezlu02
0.2905983 0.2321429
#Now convert the data in a usable format
df <- as.numeric(OBP)
df[1:20]
[1] 0.3287037 0.3246753 0.2485876 0.2945205 0.2784091
0.3021978 0.2791878
[8] 0.2943548 0.2905983 0.2321429 0.2616279 0.3198529 0.3254593
0.3561644
[15] 0.2958580 0.2388060 0.2846154 0.2916667 0.3643725
0.2800000
# Quantile Plot
# qqnorm()function will do this for us
qqnorm(df)
#Now use density plot
plot(density(df))
# We will also use shapiro.test() function to perform Shapiro-Wilk
test
# Ho: Data is normal H1: Data is not normal
# If p-value<0.05 Reject null hypothesis otherwise fail to
reject null hypothesis
shapiro.test(df)
Shapiro-Wilk normality test
data: df
W = 0.97092, p-value = 1.206e-07
# p-value = 1.206e-07 < 0.05, Hence reject the null
hypothesis.
# Our data is not normally distributed
# You can also see in the density plot that it is positively
skewed.
# Also in the quantile plot points are not distributed close to the
diagonal line.
# Our data is not normally distributed.
*the bold text is output