2025-09-21

Introduction

A collection of height data from 30 students is being analyzed for patterns like height, variation and trends between gender and age.

Including:

  • Statistical Formulas
  • Visuals (ggplot2 and plotly)
  • R Code

Statistical Formula

Here is how we calculate the mean of height:

\[ \text{Mean} = \bar{x} = \frac{1}{n} \sum_{i=1}^n x_i \]

Statistical Formula (continued)

Here is how we calculate the standard deviation of height: \[ \text{Standard Deviation} = s = \sqrt{\frac{1}{n-1} \sum_{i=1}^n (x_i - \bar{x})^2} \]

PLOTLY

Code used for Plotly

students = data.frame (name = paste(“Student”, 1:30),
height = rnorm(30, mean = 165, sd = 10),
gender = sample(c(“Male”, “Female”),30 , replace = TRUE),
age = sample(18:30, 30, replace = TRUE))
p <- plot_ly(students, x = ~age, y = ~height, z = ~gender, type = ‘scatter3d’, mode = ‘markers’)
p <- layout(p,title = “3D Plot: Age vs Height vs Gender”, scene = list(xaxis = list(title = “Age”), yaxis = list(title = “Height (cm)”), zaxis = list(title = “Gender”) ))
p

GGPLOT #1

GGPLOT #2