Code (from history):
read.csv(“USMA_Progression.csv”) df<- read.csv(“USMA_Progression.csv”) df<- read.csv(‘USMA_Progression.csv’) read.csv(“/home/downloads/r stuff/USMA_Progression.csv”) setwd(“/Users/charlieburgess/Downloads/r stuff”) setwd(“/home/downloads/r stuff”) data <- read.csv(“USMA_Progression.csv”) View(data) data <- read.csv(USMA_data) data <- read.csv(USMA_data.csv) View(data) install.packages(“dplyr”) library(dplyr) USMAdata %-% head(10) USMA_data.csv <- transform(USMA_data.csv, femalespeers_recreated = ave(female, year, class, company_n, FUN = sum)) USMA_data <- read.csv(“USMA_data.csv”) USMA_data <- transform(USMA_data, femalespeers_recreated = ave(female, year, class, company_n, FUN = sum)) USMA_data <- transform(USMA_data, malespeers_recreated = ave(male, year, class, company_n, FUN = sum)) USMA_data <- transform(USMA_data, totpeople_recreated = ave(female + !female, year, class, company_n, FUN = sum)) totpeople_recreated <- ave(female + !female + 1, year, class, company_n, FUN = sum) USMA_data <- transform(USMA_data, totpeople_recreated = ave(female + !female + 1, year, class, company_n, FUN = sum)) USMA_data <- transform(USMA_data, totpeople_recreated = ave(female + !female + 1, year, class, company_n, FUN = sum)) library(dplyr) USMA_data <- USMA_data %>% group_by(year, class, company_n) %>% mutate(totpeople_recreated = sum(female + !female) + 1) USMA_data <- select(data, -totpeople_recreated2) data <- transform(USMA_data, company = substr(company_n, 1, 1), division = substr(company_n, 3, nchar(company_n))) data <- transform(USMA_data, company = substr(company_n, 1, 1),division = substr(company_n, 3, nchar(company_n))) USMA_data\(company <- substr(USMA_data\)company_n, 1, 1) USMA_data\(division <- substr(USMA_data\)company_n, 3, nchar(USMA_data\(company_n)) library(dplyr) USMA_data_1981 <- filter(USMA_data, year == 81) library(dplyr) USMA_data_1981 <- USMA_data[USMA_data\)year == 81, ] USMA_data_1981 View(USMA_data_1981) library(dplyr) companies_by_continuation <- USMA_data_1981 %>% group_by(company_n) %>% companies_by_continuation <- USMA_data_1981 %>% group_by(company) %>% summarize(continue_or_grad_rate = mean(continue_or_grad)) %>% arrange(desc(continue_or_grad_rate)) library(dplyr) company_rates <- USMA_data %>% group_by(company) %>% summarize(continue_or_grad_rate = mean(continue_or_grad)) %>% arrange(desc(continue_or_grad_rate)) View(company_rates) head(company_rates), 4) head(company_rates, 4) top4company_continuation <- head(company_rates, 4) View(top4company_continuation) library(dplyr) continuation_by_class <- USMA_data_1981 %>% group_by(class) %>% summarize(continue_or_grad_rate = mean(continue_or_grad)) arrange(desc(continue_or_grad_rate)) library(dplyr) > continuation_by_class <- USMA_data_1981 %>% library(dplyr)> continuation_by_class <- USMA_data_1981 %>% + group_by(class) %>% + summarize(continue_or_grad_rate = mean(continue_or_grad)) library(dplyr) continuation_by_class <- USMA_data %>% group_by(class) %>% summarize(continue_or_grad_rate = mean(continue_or_grad)) %>% arrange(desc(continue_or_grad_rate)) View(continuation_by_class) head(10) continuation_by_class <- head(continue_or_grad_rate, 10) continuation_by_class <- head(continue_or_grad_rate, 10 continuation_by_class_women <- USMA_data_1981 %>% continuation_by_class_women <- USMA_data_1981 %>% filter(female == 1) %>% group_by(class) %>% summarize(continue_or_grad_rate = mean(continue_or_grad)) %>% arrange(desc(continue_or_grad_rate)) View(continuation_by_class_women) women_per_class <- USMA_data_1981 %>% filter(female == 1) %>% group_by(class) %>% summarize(num_women = sum(female)) View(women_per_class)
Tables:
For questions 2/4. ‘USMA_data’, the original data table with added recreations of malespeers, femalespeers and totpeople, as well as the added company and division variables derived from company_n:
| year | class | female | femalespeers | malespeers | continue_or_grad | company_n | totpeople | femalespeers_recreated | malespeers_recreated | totpeople_recreated | company | division |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 78 | 1 | 0 | 0 | 34 | 1 | A-1 | 35 | 0 | 34 | 35 | A | 1 |
| 78 | 1 | 0 | 0 | 34 | 1 | A-1 | 35 | 0 | 34 | 35 | A | 1 |
| 78 | 1 | 0 | 0 | 34 | 1 | A-1 | 35 | 0 | 34 | 35 | A | 1 |
| 78 | 1 | 0 | 0 | 34 | 1 | A-1 | 35 | 0 | 34 | 35 | A | 1 |
| 78 | 1 | 0 | 0 | 34 | 1 | A-1 | 35 | 0 | 34 | 35 | A | 1 |
| 78 | 1 | 0 | 0 | 34 | 1 | A-1 | 35 | 0 | 34 | 35 | A | 1 |
| 78 | 1 | 0 | 0 | 34 | 1 | A-1 | 35 | 0 | 34 | 35 | A | 1 |
| 78 | 1 | 0 | 0 | 34 | 1 | A-1 | 35 | 0 | 34 | 35 | A | 1 |
| 78 | 1 | 0 | 0 | 34 | 1 | A-1 | 35 | 0 | 34 | 35 | A | 1 |
| 78 | 1 | 0 | 0 | 34 | 1 | A-1 | 35 | 0 | 34 | 35 | A | 1 |
| year | class | female | femalespeers | malespeers | continue_or_grad | company_n | totpeople | femalespeers_recreated | malespeers_recreated | totpeople_recreated | company | division |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 81 | 1 | 0 | 3 | 31 | 0 | A-1 | 35 | 3 | 31 | 35 | A | 1 |
| 81 | 1 | 0 | 3 | 31 | 0 | A-1 | 35 | 3 | 31 | 35 | A | 1 |
| 81 | 1 | 0 | 3 | 31 | 0 | A-1 | 35 | 3 | 31 | 35 | A | 1 |
| 81 | 1 | 0 | 3 | 31 | 0 | A-1 | 35 | 3 | 31 | 35 | A | 1 |
| 81 | 1 | 0 | 3 | 31 | 0 | A-1 | 35 | 3 | 31 | 35 | A | 1 |
| 81 | 1 | 0 | 3 | 31 | 1 | A-1 | 35 | 3 | 31 | 35 | A | 1 |
| 81 | 1 | 0 | 3 | 31 | 1 | A-1 | 35 | 3 | 31 | 35 | A | 1 |
| 81 | 1 | 1 | 3 | 31 | 1 | A-1 | 35 | 3 | 31 | 35 | A | 1 |
| 81 | 1 | 0 | 3 | 31 | 1 | A-1 | 35 | 3 | 31 | 35 | A | 1 |
| 81 | 1 | 0 | 3 | 31 | 1 | A-1 | 35 | 3 | 31 | 35 | A | 1 |
6a. ‘top4company_continuation’, this table shows the 4 companies with the highest continuation rates in order:
| company | continue_or_grad_rate |
|---|---|
| D | 0.9264249 |
| A | 0.9183673 |
| H | 0.9153077 |
| B | 0.9139842 |
6b. ‘continuation_by_class’, this table shows the classes with the highest continuation rates on order:
| class | continue_or_grad_rate |
|---|---|
| 4 | 0.9712418 |
| 3 | 0.9572864 |
| 2 | 0.8891413 |
| 1 | 0.8478868 |
6c.’continuation_by_class_women’, this table shows the classes with the highest rate of continuation for the women in their class:
| class | continue_or_grad_rate |
|---|---|
| 4 | 0.9838710 |
| 3 | 0.9090909 |
| 1 | 0.8120301 |
| 2 | 0.6847826 |
| class | num_women |
|---|---|
| 1 | 133 |
| 2 | 92 |
| 3 | 66 |
| 4 | 62 |
Written answers:
I could only find one row where my recreations do not line up with the originals, row 73. I tried to find a pattern as to why this row did not work, perhaps it was because this student didn’t continue, because they are in company-number A-2, or because they had a sizable number of female peers. However when I looked at other rows that shared these variables in common with row 73, none of those rows had discrepancies with the old and new variables, so I am baffled as to why this is happening. I trust the original data more here because my row 73 shows that this person had 2 people in their classes, which cannot be right. I am interested why this is happening, or what the problem with the original data was supposed to be.
I have two observations about the random assignment of women; one is that class 1 has a lot more women than the others, more than classes 3 and 4 combined in fact, class 2 also has considerably more than 3 and 4. This might not be ‘strange’ though, these discrepencies can happen if women were truly randomly assigned to a class. The other thing that I noticed is that class 2’s women had a much lower continuation rate the other classes, perhaps there were factors in that class which led to it being harder for women to succeed.