Family relationships are well known to heavily influence a student’s academic performance. Higher quality relationships tend to be a protective factor from negative acedemic trajectories, while low quality family relationships tend to act as predictors of these negative outcomes. Family structure might also play a role in how students feel about these relationships. For instance, a single parent with a big family might not be able to give each child the full amount of emotional support they need because they are facing many other burdens and stressors. Additionally, gender is an important variable to consider since many school and familial experiences vary by gender. For example, girls tend to have higher quality relationships with their families than boys because girls are often socialized to be more family oriented. The present study will look to see how family structure (Pstatus and family size) influences familial relationship quality (femrel), how these variables relate to academic performance (G3 and studytime), and how these relationships might differ by gender (sex).

Research Questions:

RQ1: What are the relationships between study time and GPA? Hypothesis: As study time increases, GPA will increase.

RQ2: How does GPA and study hours relate to family structure and family relationships? Hypothesis: GPA and study hours will be positively associated with family relationship quality, but these variables will not be directly related to family structure (size or Pstatus).

RQ3: How do these relationships change when the full sample is split by gender? Hypothesis: Family size will negatively affect the academic performance of girls more than boys because girls are more likely to be put into a family oriented role. When families are big, girls probably spend more time helping out than studying, or are interrupted more often while studying. Boys will receive higher grades in math because of stereotype threat. Girls will have higher quality relationships with their families.

Variables:

Family Structure and Relationships: family relationships (quality: scale 1-5), family size (binary: >3 or <3), parent cohabitation (Pstatus, binary: Together or Apart)

Academic Performance: GPA (G3, numeric: scale 1-20), study time (numeric: 1 - <2 hours, 2 - 2 to 5 hours, 3 - 5 to 10 hours, or 4 - >10 hours), wants higher education (binary: y/n), absences (scale: 0-93)

Subject Variables: Gender (binary : boy or girl) and age (numeric: 15-22 years)

library(tidyverse)
## -- Attaching packages ------------------------------ tidyverse 1.3.0 --
## v ggplot2 3.3.2     v purrr   0.3.4
## v tibble  3.0.3     v dplyr   1.0.2
## v tidyr   1.1.1     v stringr 1.4.0
## v readr   1.3.1     v forcats 0.5.0
## -- Conflicts --------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
d1=read.table("student-mat.csv",sep=";",header=TRUE)

#view(d1)
#str(d1) -- 395 participants 

 #Does study time relate differently to GPA for boys than girls? 
    ggplot(d1, aes(studytime, G3))+
       geom_point()+
       facet_wrap(~sex)+
      geom_smooth(method = 'lm', se = FALSE)
## `geom_smooth()` using formula 'y ~ x'

      #While it seems that there is a small main effect of gender,        the amount of study time is not related to GPA differently       for boys than girls. 

#Does the realtionships between study hours and GPA differ between boys and girls for large vs small fmaily sizes? 
  ggplot(d1, aes(studytime, G3, color = sex))+
    geom_point()+
    facet_wrap(~famsize)+
    geom_smooth(method = 'lm', se = FALSE)
## `geom_smooth()` using formula 'y ~ x'

   #study time and GPAmath seem to be related the same for both         genders in smaller families but rated differently by gender       in bigger families

#How does the association between GPA and family relationships differ between genders in big vs small famililies?
  ggplot(d1, aes(famrel, G3, color = sex))+
   geom_point()+
   facet_wrap(~famsize)+
    geom_smooth(method = "lm", se = FALSE)
## `geom_smooth()` using formula 'y ~ x'

    #for smaller families, famrel seems to be more positively associated with GPA
    #girls seem to be better off GPA wise in smaller families