#loading data
data(iris)
Hitogram
hist(iris$Sepal.Length, main = "Histogram of Iris sepal length",
col = "grey", xlab = "sepal length")
hist(iris$Sepal.Length, main = "Histogram of Iris sepal length",
col = "grey", xlab = "sepal length", breaks = 16 )
hist(iris$Sepal.Length, main = "Histogram of Iris sepal length",
col = "grey", xlab = "sepal length")
hist(iris$Sepal.Width, main = "Histogram of Iris sepal width",
col = "grey", xlab = "sepal length")
hist(iris$Petal.Length, main = "Histogram of Iris petal length",
col = "grey", xlab = "petal length")
hist(iris$Petal.Width, main = "Histogram of Iris petal width",
col = "grey", xlab = "petal width")
Density plot
Sepal.LengthMean <- mean(iris$Sepal.Length)
Sepal.WidthMean <- mean(iris$Sepal.Width)
Petal.LengthMean <- mean(iris$Petal.Length)
Petal.WidthMean <- mean(iris$Petal.Width)
Sepal.LengthSD <- sd(iris$Sepal.Length)
Sepal.WidthSD <- sd(iris$Sepal.Width)
Petal.LengthSD <- sd(iris$Petal.Length)
Petal.WidthSD <- sd(iris$Petal.Width)
#density plot
hist(iris$Sepal.Length,
main = "Density plot of Iris sepal length",
col = "grey", xlab = "sepal length", freq=FALSE,
ylim=c(0,0.55))
curve(dnorm(x, mean=Sepal.LengthMean,
sd= Sepal.LengthSD), add= TRUE, col="red", lwd =2)
hist(iris$Sepal.Width,
main = "Density plot of Iris sepal width",
col = "grey", xlab = "sepal length", freq=FALSE)
curve(dnorm(x, mean=Sepal.WidthMean,
sd=Sepal.WidthSD), add= TRUE, col="red", lwd=2)
hist(iris$Petal.Length,
main = "Density plot of Iris petal length",
col = "grey", xlab = "petal length", freq=FALSE)
curve(dnorm(x, mean=Petal.LengthMean,
sd=Petal.LengthSD ),add=TRUE, col="red", lwd=2)
hist(iris$Petal.Width,
main = "Density plot of Iris petal width",
col = "grey", xlab = "petal width", freq = FALSE)
curve(dnorm(x, mean = Petal.WidthMean,
sd=Petal.WidthSD), add=TRUE, col="red", lwd=2)









