2024-03-16

Introduction

Using the “iris” dataset we are going to find the mean Sepal Length, Sepal Width, and Petal Length for Setosa, Versicolor, and Virginica flowers and show the relationship between these variables.

3D Scatter Plot (Sepal Length vs. Sepal Width vs. Petal Length)

A 3D scatter plot showing the relationship between Petal Length, Sepal Width.

R Code Used for 3D Scatter Plot

plot_ly(x = iris$Sepal.Length, y = iris$Sepal.Width, z = iris$Petal.Length, 
        type = "scatter3d", mode = "markers", color = iris$Petal.Length) %>%
  layout(scene = list(xaxis = list(title = "Sepal Length"),
                      yaxis = list(title = "Sepal Width"),
                      zaxis = list(title = "Petal Length")))

Relationship Between Sepal Length and Sepal Width

Relationship Between Sepal Length and Petal Length

Relationship Between Petal Length and Sepal Width

Mean Sepal Length of Each Flower Type

The mean Sepal Length of Setosa Flowers (\(\frac{1}{n} \sum_{i=1}^{n} (x_i)\) Where x represents Setosa Sepal Length is 5.006

The mean Sepal Length of Versicolor Flowers (\(\frac{1}{n} \sum_{i=1}^{n} (y_i)\) Where y represents Versicolor Sepal Length is 5.936

The mean Sepal Length of Virginica Flowers (\(\frac{1}{n} \sum_{i=1}^{n} (z_i)\) Where z represents Virginica Sepal Length is 6.588

Mean Petal Length of Each Flower Type

The mean Petal Length of Setosa Flowers (\(\frac{1}{n} \sum_{i=1}^{n} (x_i)\) Where x represents Setosa Petal Length is 1.462

The mean Petal Length of Versicolor Flowers (\(\frac{1}{n} \sum_{i=1}^{n} (y_i)\) Where y represents Versicolor Petal Length is 4.26

The mean Petal Length of Virginica Flowers (\(\frac{1}{n} \sum_{i=1}^{n} (z_i)\) Where z represents Virginica Petal Length is 5.552

Mean Petal Width of Each Flower Type

The mean Petal Width of Setosa Flowers (\(\frac{1}{n} \sum_{i=1}^{n} (x_i)\) Where x represents Setosa Petal Width is 0.246

The mean Petal Width of Versicolor Flowers (\(\frac{1}{n} \sum_{i=1}^{n} (y_i)\) Where y represents Versicolor Petal Width is 1.326

The mean Petal Width of Virginica Flowers (\(\frac{1}{n} \sum_{i=1}^{n} (z_i)\) Where z represents Virginica Petal Width is 2.026