Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

R Exercise Please share your R script and relevant output. An easy way to do thi

ID: 3354121 • Letter: R

Question

R Exercise Please share your R script and relevant output. An easy way to do this is to go to “File” menu and select “Compile Notebook.” Hit the “Compile” button and then select HTML and copy and paste this into a word document, or print it out as an HTML page. If compiling a report is not working for you, you can copy and paste your script and results into a Word document. Let me know if this doesn’t work, so we can solve it before the next assignment.

In the first lecture, we discussed the controversial case of gender discrimination in University of California-Berkeley’s graduate admissions process. Let’s teleport back to the fall of 1973. Applications for the upcoming 1974 academic year are in, and you’re on the admission review board responsible for overseeing the admission results. You know going into the application review season that Berkeley’s long run average rate of admission is 40 percent for both men and women. This year 4,321 women and 8,442 men submitted applications.

• Assuming the departments admit applicants at the historical rate, how many admitted applicants should we expect to see for this upcoming school year? How many of these applicants are men? How many are women? Use R to calculate this number.

• Use the pbinom function to calculate the probability of admitting more than 8,000 men, assuming the applicants perform along historical expectations. (Hint: 0 P(X=x) 1).

• Use the dbinom function to calculate the probability of admitting 35 percent of the female applicants, assuming the applicants perform along historical expectations. (Hint: You should end up with a value between 0 and 1.)

how do I do this question on R?

Explanation / Answer

Sure, I will help you.

The R code and output is given below.

men_appl <- 8442

women_appl <- 4321

total_appl <- men_appl + women_appl

total_admit <- total_appl * 0.40

total_admit_round <- round(total_admit)

print(paste("Total number of admitted applicants expected for this year is:", total_admit_round))

## [1] "Total number of admitted applicants expected for this year is: 5105"

men_admit <- men_appl * 0.40

men_admit_round <- round(men_admit)

print(paste("Number of male admitted applicants expected for this year is:", men_admit_round))

## [1] "Number of male admitted applicants expected for this year is: 3377"

women_admit_round <- total_admit_round - men_admit_round

# women_admit <- women_appl * 0.40 Alternative method

# women_admit_round <- round(women_admit) Alternative method

print(paste("Number of female admitted applicants expected for this year is:", women_admit_round))

## [1] "Number of female admitted applicants expected for this year is: 1728"

prob1 <- pbinom(q = 8000, size = men_appl, prob = 0.40, lower.tail = FALSE)

print(paste("The probability of admitting more than 8,000 men is:", prob1))

## [1] "The probability of admitting more than 8,000 men is: 0"

prob2 <- dbinom(x = round(women_appl * 0.35), size = women_appl, prob = 0.40)

print(paste("The probability of admitting exactly 35% of women applcants (1512 women) is:", prob2))

## [1] "The probability of admitting exactly 35% of women applcants (1512 women) is: 1.38567785627568e-12"