Introduction

In my project, I chose to analyze the XAPI-Edu dataset obtained from [Kaggle]. This dataset contains information on student interactions and engagement levels in an educational setting. ## Data Exploration

…

("https://www.westend61.de/en/photo/CAIF02492/students-raising-hands-in-class")
## [1] "https://www.westend61.de/en/photo/CAIF02492/students-raising-hands-in-class"

#Load the necessary libraries

library(readr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Load the dataset

setwd("C:/Users/MCuser/Desktop/data")
dataset <- read_csv("xAPI-Edu-Data.csv.csv")
## Rows: 480 Columns: 17
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (13): gender, NationalITy, PlaceofBirth, StageID, GradeID, SectionID, To...
## dbl  (4): raisedhands, VisITedResources, AnnouncementsView, Discussion
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

View the structure of the dataset

str(dataset)
## spc_tbl_ [480 × 17] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
##  $ gender                  : chr [1:480] "M" "M" "M" "M" ...
##  $ NationalITy             : chr [1:480] "KW" "KW" "KW" "KW" ...
##  $ PlaceofBirth            : chr [1:480] "KuwaIT" "KuwaIT" "KuwaIT" "KuwaIT" ...
##  $ StageID                 : chr [1:480] "lowerlevel" "lowerlevel" "lowerlevel" "lowerlevel" ...
##  $ GradeID                 : chr [1:480] "G-04" "G-04" "G-04" "G-04" ...
##  $ SectionID               : chr [1:480] "A" "A" "A" "A" ...
##  $ Topic                   : chr [1:480] "IT" "IT" "IT" "IT" ...
##  $ Semester                : chr [1:480] "F" "F" "F" "F" ...
##  $ Relation                : chr [1:480] "Father" "Father" "Father" "Father" ...
##  $ raisedhands             : num [1:480] 15 20 10 30 40 42 35 50 12 70 ...
##  $ VisITedResources        : num [1:480] 16 20 7 25 50 30 12 10 21 80 ...
##  $ AnnouncementsView       : num [1:480] 2 3 0 5 12 13 0 15 16 25 ...
##  $ Discussion              : num [1:480] 20 25 30 35 50 70 17 22 50 70 ...
##  $ ParentAnsweringSurvey   : chr [1:480] "Yes" "Yes" "No" "No" ...
##  $ ParentschoolSatisfaction: chr [1:480] "Good" "Good" "Bad" "Bad" ...
##  $ StudentAbsenceDays      : chr [1:480] "Under-7" "Under-7" "Above-7" "Above-7" ...
##  $ Class                   : chr [1:480] "M" "M" "L" "L" ...
##  - attr(*, "spec")=
##   .. cols(
##   ..   gender = col_character(),
##   ..   NationalITy = col_character(),
##   ..   PlaceofBirth = col_character(),
##   ..   StageID = col_character(),
##   ..   GradeID = col_character(),
##   ..   SectionID = col_character(),
##   ..   Topic = col_character(),
##   ..   Semester = col_character(),
##   ..   Relation = col_character(),
##   ..   raisedhands = col_double(),
##   ..   VisITedResources = col_double(),
##   ..   AnnouncementsView = col_double(),
##   ..   Discussion = col_double(),
##   ..   ParentAnsweringSurvey = col_character(),
##   ..   ParentschoolSatisfaction = col_character(),
##   ..   StudentAbsenceDays = col_character(),
##   ..   Class = col_character()
##   .. )
##  - attr(*, "problems")=<externalptr>

Summary statistics

summary(dataset)
##     gender          NationalITy        PlaceofBirth         StageID         
##  Length:480         Length:480         Length:480         Length:480        
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##    GradeID           SectionID            Topic             Semester        
##  Length:480         Length:480         Length:480         Length:480        
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##    Relation          raisedhands     VisITedResources AnnouncementsView
##  Length:480         Min.   :  0.00   Min.   : 0.0     Min.   : 0.00    
##  Class :character   1st Qu.: 15.75   1st Qu.:20.0     1st Qu.:14.00    
##  Mode  :character   Median : 50.00   Median :65.0     Median :33.00    
##                     Mean   : 46.77   Mean   :54.8     Mean   :37.92    
##                     3rd Qu.: 75.00   3rd Qu.:84.0     3rd Qu.:58.00    
##                     Max.   :100.00   Max.   :99.0     Max.   :98.00    
##    Discussion    ParentAnsweringSurvey ParentschoolSatisfaction
##  Min.   : 1.00   Length:480            Length:480              
##  1st Qu.:20.00   Class :character      Class :character        
##  Median :39.00   Mode  :character      Mode  :character        
##  Mean   :43.28                                                 
##  3rd Qu.:70.00                                                 
##  Max.   :99.00                                                 
##  StudentAbsenceDays    Class          
##  Length:480         Length:480        
##  Class :character   Class :character  
##  Mode  :character   Mode  :character  
##                                       
##                                       
## 

Distribution of variables

Load necessary libraries

library(plotly)
## Warning: package 'plotly' was built under R version 4.3.3
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout

Create an interactive histogram with color

histogram <- plot_ly(x = ~dataset$raisedhands, type = "histogram", marker = list(color = "skyblue"))

Customize the layout

layout(histogram, title = "Interactive Histogram of Raised Hands", xaxis = list(title = "Number of Raised Hands"))

Show the plot

histogram

Check for missing values

sum(is.na(dataset))
## [1] 0

Handle missing values (if necessary)

dataset <- dataset %>% na.omit()

Select specific variables

dataset_selected <- dataset %>% select(raisedhands, VisITedResources)

Filter rows based on conditions

dataset_filtered <- dataset %>% filter(raisedhands > 50)

Summarize data

dataset_summary <- dataset %>% group_by(raisedhands) %>% summarize(mean(VisITedResources))

Load ggplot2 library

library(ggplot2)

Create a scatter plotwith color

scatter_plot <- ggplot(dataset, aes(x = raisedhands, y = VisITedResources, color = Class)) + 
  geom_point() +
  labs(x = "Raised Hands", y = "Visited Resources", color = "Class") +
  theme_minimal()

Show the scatter plot

scatter_plot

In this scatter plot, we’re visualizing the relationship between the number of raised hands and the number of visited resources for students, with each point colored by the student’s class (L, M, H). The scatter plot visualizes the relationship between the number of raised hands and the number of visited resources for students in the dataset. Each point represents a student, with the x-axis indicating the number of raised hands and the y-axis indicating the number of visited resources. The points are colored based on the student’s class (L = Low, M = Medium, H = High). From the scatter plot, we can observe that students who have a higher number of raised hands also tend to have a higher number of visited resources, indicating a potential positive correlation between classroom participation (raised hands) and engagement with course materials (visited resources). Additionally, we can see variations in this relationship across different class levels, with some classes showing stronger correlations than others.

Create a bar plot with color

bar_plot <- ggplot(dataset, aes(x = gender, fill = gender)) +
  geom_bar() +
  labs(x = "Gender", y = "Count", fill = "Gender") +
  theme_minimal()

Show the bar plot

bar_plot

This bar plot displays the distribution of genders among the students, with bars colored by gender.

The bar plot illustrates the distribution of genders among the students in the dataset. Each bar represents the count of students for each gender category (Male or Female), with bars colored accordingly. From the bar plot, we can observe that the dataset contains a relatively balanced distribution of genders, with a slightly higher count of male students compared to female students. This visualization provides insights into the gender composition of the student population, which can be useful for understanding demographic characteristics and potentially exploring gender-specific trends or patterns in student performance.

Check for non-numeric values in the “Class” variable

unique(dataset$Class)
## [1] "M" "L" "H"

Check for non-numeric values in other variables

sapply(dataset[, c("raisedhands", "VisITedResources", "AnnouncementsView", "Discussion")], function(x) any(!is.numeric(x)))
##       raisedhands  VisITedResources AnnouncementsView        Discussion 
##             FALSE             FALSE             FALSE             FALSE

Convert “Class” to a factor

dataset$Class <- factor(dataset$Class, levels = c("L", "M", "H"))

Encode “Class” as numeric

dataset$Class_numeric <- as.numeric(dataset$Class)
model <- lm(Class_numeric ~ raisedhands + VisITedResources + AnnouncementsView + Discussion, data = dataset)

Check the summary of the regression model

summary(model)
## 
## Call:
## lm(formula = Class_numeric ~ raisedhands + VisITedResources + 
##     AnnouncementsView + Discussion, data = dataset)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.44733 -0.39587 -0.09817  0.41153  1.67803 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       1.0192914  0.0539684  18.887  < 2e-16 ***
## raisedhands       0.0070514  0.0011664   6.045 3.02e-09 ***
## VisITedResources  0.0096084  0.0010273   9.353  < 2e-16 ***
## AnnouncementsView 0.0014954  0.0012543   1.192   0.2338    
## Discussion        0.0022850  0.0009459   2.416   0.0161 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5161 on 475 degrees of freedom
## Multiple R-squared:  0.5288, Adjusted R-squared:  0.5248 
## F-statistic: 133.3 on 4 and 475 DF,  p-value: < 2.2e-16

Load the plotly library

library(plotly)

Create an interactive scatter plot

interactive_plot <- plot_ly(data = dataset, x = ~raisedhands, y = ~Discussion, color = ~Class, type = "scatter", mode = "markers", 
                            marker = list(size = 10)) %>%
  layout(title = "Interactive Scatter Plot",
         xaxis = list(title = "Raised Hands"),
         yaxis = list(title = "Discussion"),
         legend = list(title = "Class"))

Show the interactive plot

interactive_plot

each point represents a student. You can hover over the points to see additional information, and the plot is colored by class (Low, Medium, High).

Visualization Analysis: The interactive scatter plot visualizes the relationship between the number of raised hands and discussion participation among students. It reveals a positive correlation between the two variables, with students who actively participate in discussions also showing a higher tendency to raise their hands in class. The bar plot representing the gender distribution provides insights into the gender composition of the student population, showing a relatively balanced distribution with a slightly higher count of male students. Lastly, the box plot illustrates variations in the distribution of raised hands among different classes, with higher medians observed in the High class, indicating potentially higher levels of engagement.

In researching the topic of student engagement, I came across several studies highlighting its significance in academic achievement and overall student success. According to a study by Fredricks et al. (2011) [https://www.sciencedirect.com/science/article/abs/pii/S0360131515300427], engaged students are more likely to demonstrate higher levels of academic performance and retention. Additionally, research by Skinner and Belmont (1993) [https://www.researchgate.net/publication/232483889_Motivation_in_the_classroom_Reciprocal_effect_of_teacher_behavior_and_student_engagement_across_the_school_year] suggests that student engagement positively impacts classroom dynamics and fosters a conducive learning environment. These findings underscore the importance of understanding and promoting student engagement in educational practices.