R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

library(readxl)
## Warning: package 'readxl' was built under R version 4.3.3
myData <- read_excel("C:/Users/taylo/Downloads/Admission.xlsx")
View(myData)
#summary of data set
summary(myData)
##     Student         Decision              SAT          Female         
##  Min.   :   1.0   Length:1230        Min.   : 800   Length:1230       
##  1st Qu.: 308.2   Class :character   1st Qu.: 996   Class :character  
##  Median : 615.5   Mode  :character   Median :1197   Mode  :character  
##  Mean   : 615.5                      Mean   :1197                     
##  3rd Qu.: 922.8                      3rd Qu.:1398                     
##  Max.   :1230.0                      Max.   :1600                     
##      HSGPA      
##  Min.   :2.210  
##  1st Qu.:2.790  
##  Median :3.360  
##  Mean   :3.363  
##  3rd Qu.:3.925  
##  Max.   :4.510
#preview of first 6 obs.
head(myData)
## # A tibble: 6 × 5
##   Student Decision   SAT Female HSGPA
##     <dbl> <chr>    <dbl> <chr>  <dbl>
## 1       1 Deny       873 No      2.57
## 2       2 Deny       861 Yes     2.65
## 3       3 Admit     1416 No      4.02
## 4       4 Deny      1135 No      2.63
## 5       5 Admit     1381 No      4.2 
## 6       6 Deny      1114 Yes     2.43

Including Plots

You can also embed plots, for example:

#make a plot
plot(myData$SAT[1:100]~myData$HSGPA[1:100],ylab="SAT Score",xlab='HSGPA')

Note that the echo= FALSE parameter can be added to the code chunk to prevent printing of the R code that generated the plot.

Question: Does there appear to be a strong relationship between HSGPA and SAT scores?

Answer

The correlation between HSGPA and SAT is 0.01

The average SAT is 1197.34 and the average HSGPA is 3.36

#install.packages("ggpubr")
library(ggpubr)
## Warning: package 'ggpubr' was built under R version 4.3.3
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 4.3.3
#make a new data frame (data set with just the first 100 obs)
first100<-myData[1:100,]
ggscatter(first100,x="HSGPA",y="SAT",add="reg.line",conf.int=TRUE,xlab="HSGPA",ylab="SAT",color="Female")

p <-ggboxplot(myData,x="Female",y="SAT",color="Female",shape="Female")
p