--- title: "XX" shorttitle: "XX" author: - name: XX affiliation: 1 corresponding: yes address: XX email: XX affiliation: - id: 1 institution: XX abstract: | XX note: | TXX keywords: "XX, XX, XX" wordcount: X class: man lang: english figsintext: yes # Should figures be in text? lineno: no # Should line numbers be displayed? bibliography: - studentAPA.bib # What is the name of the bibliography file? output: papaja::apa6_pdf --- ```{r setup, include = FALSE} # Set default chunk options (can be overridden in later chunks) knitr::opts_chunk$set(echo = FALSE, eval = TRUE, message = FALSE, fig.width = 4, fig.height = 4, fig.align = 'center', out.width = "100%") # Load packages library("papaja") library("knitr") library("tidyverse") # Load data: studentmath.txt, studentpor.txt # Note: These data MUST be in a folder called data in your project directory! student.math <- read.table(file = "data/studentmath.txt", sep = "\t", header = TRUE) student.por <- read.table(file = "data/studentpor.txt", sep = "\t", header = TRUE) ``` What is the relationship between student performance in language and mathematics tasks? This is an important question that has been studied extensively. For example, @horwitz1986foreign found that students frequently feel anxiety in foreign language classes. XXX combined several studies on language achievement and found that language-minority students may need special treatment plans. Interestingly, language appears to be related to performance in mathematics [XXX]. In one study based on a survey of 1,174 8th grade students, XXX found that students who were English language learners (ELLs) scored lower on math tests than proficient speakers of English. The purpose of the present research was to see if previous results replicate in a new sample of language and mathematics learners. To test this, we analysed data of student performance in Mathematics and Portugese classes. # Methods ## Participants Data were collected from the UCI machine learning repository at http://archive.ics.uci.edu/ml/datasets/Student+Performance. Data from `r 1+1` students in a Mathematics class, and `r 1+1` students in a Portugese class were collected. ## Procedure The primary measures were three exam scores taken at the beginning, middle, and end of each class. # Results All analyses were conducted using R [@R] and compiled using the papaja package [@aust2015papaja]. Distributions of the three exam scores for the Mathematics and Portugese classes are presented in Figure 1. Correlations between numeric predictors in the Math data are shown in Figure 2. ```{r fig1, fig.width = 6, fig.height = 4, fig.cap= "XXX", eval = FALSE} # Figure 1: Create histograms of distributions of exam scores # Create long version of the portugese data student.por.long <- student.por %>% select(G1, G2, G3) %>% gather(grade, score) %>% mutate(class = "Portugese") # Create long version of the math data student.math.long <- student.math %>% select(G1, G2, G3) %>% gather(grade, score) %>% mutate(class = "Math") # Combine two long versions student.all <- rbind(student.por.long, student.math.long) # Create grid of histograms ggplot(data = student.all, aes(x = score)) + facet_wrap(~ class + grade) + geom_histogram(col = "black", fill = "white", bins = 15) + scale_x_continuous(limits = c(0, 20)) + theme_minimal() ``` ```{r fig2, fig.width = 6, fig.height = 6, fig.cap= "XXX", eval = FALSE, out.width = "70%"} # Figure 2: Correlation plot # Get matrix of correlations math_cor <- cor(student.math[c("age", "studytime", "failures", "famrel", "freetime", "goout", "absences", "G1", "G2", "G3")]) # Matrix of p values math_p <- ggcorrplot::cor_pmat(student.math[c("age", "studytime", "failures", "famrel", "freetime", "goout", "absences", "G1", "G2", "G3")]) # Create correlation plot with ggpcorrplot ggcorrplot::ggcorrplot(math_cor, method = "circle", lab = TRUE, # Include correlation coefficient labels lab_size = 3, # Reduce label size a bit p.mat = math_p) # Include p-values so non-significant values have X's ``` Descriptive statistics of grades separated by sex and school are presented in Tables 1 and 2. Grades tended to increase over the course of the semester. For example, the mean grade in the first Portugese exam was `r 1+1` which increased to `r 1+1` by the last exam. ```{r tbl1, results='asis', eval = FALSE} # Create summary table of Portugese data portugese.tbl <- student.por %>% group_by(sex, school) %>% summarise( "Exam 1" = round(mean(G1), 2), "Exam 2" = round(mean(G2), 2), "Exam 3" = round(mean(G3), 2) ) # Print the table! # also be sure to include the results='asis' chunk option! papaja::apa_table(portugese.tbl, caption = "XXX") ``` ```{r tbl2, results='asis', eval = FALSE} # Create summary table of Math data math.tbl <- student.math %>% group_by(sex, school) %>% summarise( "Exam 1" = round(mean(G1), 2), "Exam 2" = round(mean(G2), 2), "Exam 3" = round(mean(G3), 2) ) papaja::apa_table(math.tbl, caption = "XXX") ``` ```{r ttests, eval = TRUE} # T-test of Exam 1 portugese grades between sexes sex.por.ttest <- t.test(G1 ~ sex, data = student.por) # T-test of Exam 1 math grades between sexes ``` Did men and women perform differently on the first exams in each class? To test this, we conducted two separate two-sample t-tests on first exam scores as a function of sex. The t-test on Portugese exam 1 was significant `r 1+1`, showing that women performed better than men on the first Portugese exam, The t-test on Math exam 1 was non-significant `r 1+1`, showing no evidence for a difference between men and women on Math exam 1. ```{r, results='asis', eval = FALSE} G1_por_Anova <- car::Anova(mod = lm(G1 ~ school + sex + guardian, data = student.por), type = "III") papaja::apa_table(apa_print(G1_por_Anova)$table, caption = "ANOVA on period 1 Portugese scores.") ``` # Discussion Understanding the relationship between language and math performance is important for understanding learning. Our results are generally in line with @abedi2001language who found a relationship between language and mathematics performance. # References \setlength{\parindent}{-0.5in} \setlength{\leftskip}{0.5in} \setlength{\parskip}{8pt}