1 Pocket Cash Analysis with Dark Theme Plots in R

In this homework assignment, we will analyze the distribution of pocket cash amounts for students at two different universities: Southern Methodist University (SMU) and Seattle University. We will explore the data visually using box plots, histograms, density plots, and Q-Q plots. Additionally, we will conduct a two-sample t-test to compare the means of the two groups and calculate Cohen’s d as a measure of effect size. All plots will be created using a dark theme for better visualization.

The analysis will be conducted in R using the ggplot2 and tidyverse packages for data visualization and manipulation. We will also use the nortest and moments packages for normality tests and effect size calculation, respectively. The analysis will be presented in an R Markdown document, which will include the code, visualizations, statistical analysis, and interpretation of results. The dark theme will enhance the visual appeal of the plots and provide a clear presentation of the data and findings.

Let’s begin by setting up the project and creating the datasets for SMU and Seattle University students. We will then calculate summary statistics, create visualizations, conduct statistical tests, and interpret the results. The analysis will conclude with a summary of findings and suggestions for further research. ## Project Setup ```{r setup, include=FALSE} # Load required libraries library(ggplot2) library(tidyverse) library(nortest) library(moments)

2 Set up dark theme

dark_theme <- theme_minimal() + theme( text = element_text(color = “white”), axis.text = element_text(color = “white”), axis.title = element_text(color = “white”), plot.title = element_text(color = “white”, hjust = 0.5), plot.subtitle = element_text(color = “#cccccc”, hjust = 0.5), plot.background = element_rect(fill = “#1a1a1a”, color = NA), panel.background = element_rect(fill = “#1a1a1a”, color = NA), panel.grid.major = element_line(color = “#333333”), panel.grid.minor = element_line(color = “#2b2b2b”), legend.background = element_rect(fill = “#1a1a1a”), legend.text = element_text(color = “white”), legend.title = element_text(color = “white”) )


## Create Datasets

```{r data-generation, echo=FALSE}
# Create the datasets
smu_data <- c(34, 1200, 23, 50, 60, 50, 0, 0, 30, 89, 0, 300, 400, 20, 10, 0)
seattle_data <- c(20, 10, 5, 0, 30, 50, 0, 100, 110, 0, 40, 10, 3, 0)

# Create data frame
pocket_cash_df <- data.frame(
  amount = c(smu_data, seattle_data),
  school = factor(c(rep("SMU", length(smu_data)), rep("Seattle U", length(seattle_data))))
)

print(pocket_cash_df)

2.1 Preliminary Summary of Statistics

```{r data-summary, echo=FALSE} # Calculate summary statistics summary_stats <- pocket_cash_df %>% group_by(school) %>% summarise( n = n(), mean = mean(amount), sd = sd(amount), se = sd/sqrt(n), median = median(amount) )