2024-02-04

Iris

In the dataset iris, we are given a total of 150 observations of flowers with varying lengths/sizes of petals and sepals. Included in the data are 3 species of flowers: Setosa, Versicolor, and Virginica. Using simple linear regression, we will be drawing what conclusions we are able to in this short presentation.

  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1          5.1         3.5          1.4         0.2  setosa
2          4.9         3.0          1.4         0.2  setosa
3          4.7         3.2          1.3         0.2  setosa
4          4.6         3.1          1.5         0.2  setosa
5          5.0         3.6          1.4         0.2  setosa
6          5.4         3.9          1.7         0.4  setosa

Sepal Length vs Width

The relationship between Sepal Length and Height is very similar between the three different species. As we are able to see in the plot below, the three species have similar groupings and all points are relatively close to one another.

Sepal Length vs Width cont.

Separating by species, we can take the sum of the Sepal lengths and divide by the sum of widths in order to get the corresponding slope for each species.

  Flower_Names Sepal_Slopes
1   Versicolor         2.14
2       Setosa         1.46
3    Virginica         2.22

While flowers belonging to the species Versicolor and Virginica had very similar ratios of Length to Width, Setosa flower Sepals had a ratio that was approximately 2/3 that of the others.

When looking at the slopes for Sepals, we observe a somewhat narrow range of 0.76 indicating that Sepal lengths are similar across species.

Petal Length vs Width

Our plot of Petal Length vs Width differs greatly from that of our plot of Sepal dimensions. The three species are much more spread out with members of the Setosa Species being found to have petal length and width significantly smaller than that of the other two species.

Petal Length vs Width cont.

Taking the slopes from the dimensions of Petals, we see that the results differ quite significantly from that of the Sepal data.

One of the most obvious distinction between the two plots is the difference in range when comparing the slope of the linear regresion models. While the Sepal set had a range of 0.76, we find that the Petal set of slopes has a range of 3.20, over 4 times as wide.

  Flower_Names Petal_Slopes
1   Versicolor         3.21
2       Setosa         5.94
3    Virginica         2.74

For both plots, we were able to derive the slope of the fitted line by taking the sum of all the sepal/petal lengths and the sum of all widths and plugging them into the formula: \(Slope = Rise/Run\)

Sepal Size vs Petal Size

Using the dimensions of length and width along with the assumption that most Petals and Sepals are roughly the shape of a triangle, this plot presents the relationship between Petal and Sepal sizes through approximate areas.

Sepal Size vs Petal Size cont.

There are 3 distinct groupings on the plot that are composed of observations from the 3 different Species. The data used to create plot was derived from the formula for are of a triangle:

\(Area = 1/2 * Base * Height\)

Using the information we were able to observe, it would be feasible for anyone to be able to, after knowing the species of flower, accurately predict the size, length, and/or width of the petals and sepals.

Code for Sepal vs Petal Size Plot

Sepal_Size = iris\(Sepal.Length * iris\)Sepal.Width * 1/2; Petal_Size = iris\(Petal.Length * iris\)Petal.Width * 1/2; mod = lm(Petal_Size ~ Sepal_Size, data = iris); x = Petal_Size; y = Sepal_Size

xax <- list(title = “Area of Petal”, titlefont = list(family = “Modern Computer Roman”), range = c(0,8)); yax <- list(title = “Area of Sepal”, titlefont = list(family = “Modern Computer Roman”), range = c(0,17));

fig <- plot_ly(x = x, y = y, type = “scatter”, mode = “markers”,color = Species, width = 700, height = 400) %>% layout(xaxis = xax, yaxis = yax) %>% layout(margin = list(l = 50, r = 50, t = 50, b = 50))