rm(list = ls())
setwd("~/Downloads")
library(foreign)
sex_data <- read.spss("sex_data.sav", use.value.label=TRUE, to.data.frame=TRUE)

Libraries/themes

library(ggplot2)
library(tidyverse)
library(gridExtra)
library(finalfit)
library(kableExtra)
library(xtable)
jrothsch_theme <-  theme_bw() + 
  theme(text = element_text(size = 10, face = "bold", color = "deepskyblue4"),panel.grid = element_blank(),axis.text = element_text(size = 10, color = "gray13"), axis.title = element_text(size = 10, color = "red"), legend.text = element_text(colour="Black", size=10), legend.title = element_text(colour="Black", size=7), plot.subtitle = element_text(size=14, face="italic", color="black"))

Removing obserations without our key variables

sex_data <- sex_data[!is.na(sex_data$status),]
sex_data <- sex_data[!is.na(sex_data$age),]
sex_data <- sex_data[!is.na(sex_data$Years_PrimaryPartner),]
sex_data <- sex_data[!is.na(sex_data$MALE),]

Making variables

sex_data <- sex_data %>%
  mutate(married = status == "Married")

sex_data <- sex_data %>%
  mutate(married_gender = ifelse(married, 
                                 ifelse(MALE == "Male", "Married Male", "Married Female"),
                                 ifelse(MALE == "Male", "Unmarried Male", "Unmarried Female ")))

  married_num =   length(sex_data$married[sex_data$married == T])
  unmarried_num =   length(sex_data$married[sex_data$married == T])
  
  sex_data <- sex_data %>% mutate(freq_num =  as.numeric(ifelse(sexfreq == "At least once per day", 6, 
                                ifelse(sexfreq == "3-4 times per week", 5,
                                  ifelse(sexfreq == 'At least once a week', 4,
                                       ifelse(sexfreq == 'At least once per month', 3, 
                                              ifelse(sexfreq =='At least once per year', 2,
                                                     ifelse( sexfreq =="Less than once a year", 1, 0))))))))
  
  
  female <- sex_data %>%
  filter(sex_data$MALE == "Female")

Binary graphs

bin_graphs_want <- function(df, mod, modname, modlabs,  interaction_labs){
  
  
  df2 = df[!is.na(df$want) & !is.na(mod),]
  mod = mod[!is.na(df$want) & !is.na(mod)]
  
    df2$mod_married = interaction(df2$married, mod)
     
    age <- ggplot(data = df2, aes(x = age, y = want, color = mod))  +
      geom_smooth() +
      labs(title = paste("Effect Of", modname, "On", "Want", " -- Age"), x = "Age", y = "Want", color = "") + 
      scale_x_continuous(limits = c(18, 80)) +
      scale_color_discrete(labels = modlabs) + 
      jrothsch_theme
  
  sum_inter <- df2 %>%
      group_by( mod_married) %>%
      summarize(DV = mean(want))
    
    mod_married <- ggplot(data = sum_inter,  aes(x = mod_married, y = DV)) +
    geom_bar(stat = 'identity', position = 'identity', fill = "Black") + 
      scale_x_discrete(labels = interaction_labs) + 
      labs(title = paste0("Interaction Between ", modname, "And Marriage"), y = "Want", x = "") +
      jrothsch_theme
    
    
    grid.arrange(age, mod_married)
    
}

bin_graphs_like <- function(df, mod, modname, modlabs, interaction_labs){
  

  
  df2 = df[!is.na(df$totlike) & !is.na(mod),]
  mod = mod[!is.na(df$totlike) & !is.na(mod)]
  
    df2$mod_married = interaction(df2$married, mod)
     
    age <- ggplot(data = df2, aes(x = age, y = totlike, color = mod))  +
      geom_smooth() +
      labs(title = paste("Effect Of", modname, "On", "Like", " -- Age"), x = "Age", y = "Like", color = "") + 
      scale_x_continuous(limits = c(18, 80)) +
      scale_color_discrete(labels = modlabs) + 
      jrothsch_theme
  
  sum_inter <- df2 %>%
      group_by( mod_married) %>%
      summarize(DV = mean(totlike))
    
    mod_married <- ggplot(data = sum_inter,  aes(x = mod_married, y = DV)) +
    geom_bar(stat = 'identity', position = 'identity', fill = "black") +
         scale_x_discrete(labels = interaction_labs) + 
      labs(title = paste0("Interaction Between ", modname, "And Marriage"), y = "Like", x = "") +
      jrothsch_theme
    
    
    grid.arrange(age, mod_married)
    
}
bin_graphs_freq <- function(df, mod, modname, modlabs, interaction_labs){
  

  
  df2 = df[!is.na(df$freq_num) & !is.na(mod),]
  mod = mod[!is.na(df$freq_num) & !is.na(mod)]
  
    df2$mod_married = interaction(df2$married, mod)
     
    age <- ggplot(data = df2, aes(x = age, y = freq_num, color = mod))  +
      geom_smooth() +
      labs(title = paste("Effect Of", modname, "On", "Frequency", " -- Age"), x = "Age", y = "Frequency", color = "") + 
      scale_x_continuous(limits = c(18, 80)) +
      scale_color_discrete(labels = modlabs) + 
      jrothsch_theme
  
  sum_inter <- df2 %>%
      group_by(mod_married) %>%
      summarize(DV = mean(freq_num))
    
    mod_married <- ggplot(data = sum_inter,  aes(x = mod_married, y = DV)) +
    geom_bar(stat = 'identity', position = 'identity', fill = "black") +    
      scale_x_discrete(labels = interaction_labs) + 
      labs(title = paste0("Interaction Between ", modname, "And Marriage"), y = "Frequency", x = "") +
      jrothsch_theme
    
    
    grid.arrange(age, mod_married)
    
}

Small continuous graphs

contsmall <- function(df, mod, modname, modlabs){

  df2 = df[!is.na(df$want) & !is.na(df$totlike) & !is.na(df$freq_num ) & !is.na(mod) ,]
  mod = mod[!is.na(df$want) & !is.na(df$totlike) & !is.na(df$freq_num ) & !is.na(mod)]
  
want <- ggplot(df2, aes(x=mod, y=  want)) +
  stat_summary_bin(fun.y='mean', bins=20,
                    size=2, geom='point', mapping = aes(group = married, color = married)) +
  geom_smooth(method='lm', se = F, aes(color = married)) + jrothsch_theme +
  labs(title = paste0("Interaction between marriage and ", modname ), x = modname, y = "Want")
  
like <- ggplot(df2, aes(x=mod, y = totlike)) +
  stat_summary_bin(fun.y='mean', bins=20,
                    size=2, geom='point', mapping = aes(group = married, color = married)) +
  geom_smooth(method='lm', se = F, aes(color = married)) + jrothsch_theme +
    labs( x = modname, y = "Like")


freq <- ggplot(df2, aes(x=mod, y=  freq_num)) +
  stat_summary_bin(fun.y='mean', bins=20,
                    size=2, geom='point', mapping = aes(group = married, color = married)) +
  geom_smooth(method='lm', se = F, aes(color = married)) + jrothsch_theme +
      labs( x = modname, y = "Frequency")

  

grid.arrange(want, like, freq)

}

Regressions – Standard

###################################################################################################################################
#REgressions
#########################################################################################################################
  reg_no_mod <- function(dv, df){
      dv <- as.numeric(dv)
  tx1 <- df %>% lm(dv ~ married, data = .)

  
  tx1 <- xtable(tx1)
  colnames(tx1)[colnames(tx1)=="Pr(>|t|)"] <- "p_value"
    colnames(tx1)[colnames(tx1)=="t value"] <- "t_value"

  
  tx1 <- tx1 %>%
    mutate(p_value = round(p_value, 4)) %>%
    mutate(t_value = round(t_value, 3)) %>%
    mutate(p_value= cell_spec(p_value, "html", background = ifelse(p_value < .01, "gold", "white"))) %>%
    mutate(t_value= cell_spec(t_value, "html", background = ifelse(t_value < -2.5, "#FF6347", 
                                                                   ifelse(t_value > 2.5, "lightgreen", "white"))))

  
  rownames(tx1) <- c("Intercept", "Married: True")
  
kable(tx1, row.names= T, align=c("l", "l", "r", "r", "r", "r")  ,
            booktabs=TRUE, escape = F) %>% 
    kable_styling(font_size=8) 
    
  }


###########################################################################################################################
  reg_no_mod_i <- function(dv, df){

  dv <- as.numeric(dv)
  tx1 <- df %>% lm(dv ~ married + age + married*age, data = .)

  tx1 <- xtable(tx1)
  colnames(tx1)[colnames(tx1)=="Pr(>|t|)"] <- "p_value"
    colnames(tx1)[colnames(tx1)=="t value"] <- "t_value"

  
  tx1 <- tx1 %>%
    mutate(p_value = round(p_value, 4)) %>%
    mutate(t_value = round(t_value, 3)) %>%
    mutate(p_value= cell_spec(p_value, "html", background = ifelse(p_value < .01, "gold", "white"))) %>%
    mutate(t_value= cell_spec(t_value, "html", background = ifelse(t_value < -2.5, "#FF6347", 
                                                                   ifelse(t_value > 2.5, "lightgreen", "white"))))

  
  rownames(tx1) <- c("Intercept", "Married: TRUE", "Age",  "Married X Age")
  
kable(tx1, row.names= T, align=c("l", "l", "r", "r", "r", "r")  ,
            booktabs=TRUE, escape = F) %>% 
    kable_styling(font_size=8) 
    
  }

##################################################################################################################

  reg_no_mod_control <- function(dv, df){

  dv <- as.numeric(dv)
  tx1 <- df %>% lm(dv ~ married + age +  Years_PrimaryPartner + MALE, data = .)

  tx1 <- xtable(tx1)
  colnames(tx1)[colnames(tx1)=="Pr(>|t|)"] <- "p_value"
    colnames(tx1)[colnames(tx1)=="t value"] <- "t_value"

  
  tx1 <- tx1 %>%
    mutate(p_value = round(p_value, 4)) %>%
    mutate(t_value = round(t_value, 3)) %>%
    mutate(p_value= cell_spec(p_value, "html", background = ifelse(p_value < .01, "gold", "white"))) %>%
    mutate(t_value= cell_spec(t_value, "html", background = ifelse(t_value < -2.5, "#FF6347", 
                                                                   ifelse(t_value > 2.5, "lightgreen", "white"))))

  
  rownames(tx1) <- c("Intercept", "Married: TRUE", "Age",  "Duration", "MALE")
  
kable(tx1, row.names= T, align=c("l", "l", "r", "r", "r")  ,
            booktabs=TRUE, escape = F) %>% 
    kable_styling(font_size=8) 
    
  }

##################################################################################################################

  reg_just_mod_i <- function(dv, df, mod, modname){
    
      dv <- as.numeric(dv)
  tx1 <- df %>% lm(dv ~ married + mod, data = .)

  
  tx1 <- xtable(tx1)
  colnames(tx1)[colnames(tx1)=="Pr(>|t|)"] <- "p_value"
    colnames(tx1)[colnames(tx1)=="t value"] <- "t_value"

  
  tx1 <- tx1 %>%
    mutate(p_value = round(p_value, 4)) %>%
    mutate(t_value = round(t_value, 3)) %>%
    mutate(p_value= cell_spec(p_value, "html", background = ifelse(p_value < .01, "gold", "white"))) %>%
    mutate(t_value= cell_spec(t_value, "html", background = ifelse(t_value < -2.5, "#FF6347", 
                                                                   ifelse(t_value > 2.5, "lightgreen", "white"))))

  
  rownames(tx1) <- c("Intercept", "Married: True", modname)
  
kable(tx1, row.names= T, align=c("l", "l", "r", "r", "r")  ,
            booktabs=TRUE, escape = F) %>% 
    kable_styling(font_size=8) 
    
  }
  
#############################################################################################################################################################################################################################################################
  reg_full_control <- function(dv, df, mod, modname){
     
     dv <- as.numeric(dv)
       tx1 <- df %>% lm(dv ~ married + mod + age + Years_PrimaryPartner + MALE, data = .)
  
      
  tx1 <- xtable(tx1)
  colnames(tx1)[colnames(tx1)=="Pr(>|t|)"] <- "p_value"
    colnames(tx1)[colnames(tx1)=="t value"] <- "t_value"

  
  tx1 <- tx1 %>%
    mutate(p_value = round(p_value, 4)) %>%
    mutate(t_value = round(t_value, 3)) %>%
    mutate(p_value= cell_spec(p_value, "html", background = ifelse(p_value < .01, "gold", "white"))) %>%
    mutate(t_value= cell_spec(t_value, "html", background = ifelse(t_value < -2.5, "#FF6347", 
                                                                   ifelse(t_value > 2.5, "lightgreen", "white"))))

  
  rownames(tx1) <- c("Intercept", "Married: True", modname, "Age (years)", "Duration", "Male")
  
kable(tx1, row.names= T, align=c("l", "l", "r", "r", "r")  ,
            booktabs=TRUE, escape = F) %>% 
    kable_styling(font_size=8) 
    
  
    
  }


 


#############################################################################################################################################################################################################################################################
  reg_full_control_i <- function(dv, df, mod, modname){
    
          dv <- as.numeric(dv)
  tx1 <- df %>% lm(dv ~ married + mod + age + Years_PrimaryPartner + MALE + married*age, data = .)

  
  tx1 <- xtable(tx1)
  colnames(tx1)[colnames(tx1)=="Pr(>|t|)"] <- "p_value"
    colnames(tx1)[colnames(tx1)=="t value"] <- "t_value"

  
  tx1 <- tx1 %>%
    mutate(p_value = round(p_value, 4)) %>%
    mutate(t_value = round(t_value, 3)) %>%
    mutate(p_value= cell_spec(p_value, "html", background = ifelse(p_value < .01, "gold", "white"))) %>%
    mutate(t_value= cell_spec(t_value, "html", background = ifelse(t_value < -2.5, "#FF6347", 
                                                                   ifelse(t_value > 2.5, "lightgreen", "white"))))

  
  rownames(tx1) <- c("Intercept", "Married: True", modname, "Age (years)", "Duration", "Male", "Married X Age")
  
kable(tx1, row.names= T, align=c("l", "l", "r", "r")  ,
            booktabs=TRUE, escape = F) %>% 
    kable_styling(font_size=8) 
  }

Subsets where controls can’t be used – e.g. one gender subsets

     reg_full_control_gend <- function(dv, df, mod, modname){

    
      dv <- as.numeric(dv)
      
       tx1 <- df %>% lm(dv ~ married + mod + age + Years_PrimaryPartner, data = .)
  
      
  tx1 <- xtable(tx1)
  colnames(tx1)[colnames(tx1)=="Pr(>|t|)"] <- "p_value"
    colnames(tx1)[colnames(tx1)=="t value"] <- "t_value"

  
  tx1 <- tx1 %>%
    mutate(p_value = round(p_value, 4)) %>%
    mutate(t_value = round(t_value, 3)) %>%
    mutate(p_value= cell_spec(p_value, "html", background = ifelse(p_value < .01, "gold", "white"))) %>%
    mutate(t_value= cell_spec(t_value, "html", background = ifelse(t_value < -2.5, "#FF6347", 
                                                                   ifelse(t_value > 2.5, "lightgreen", "white"))))

  
  rownames(tx1) <- c("Intercept", "Married: True", modname, "Age (years)", "Duration" )
  
kable(tx1, row.names= T, align=c("l", "l", "r", "r")  ,
            booktabs=TRUE, escape = F) %>% 
    kable_styling(font_size=8) 
    
  
    
     }

 reg_full_control_gend_i <- function(dv, df, mod, modname){
    
          dv <- as.numeric(dv)
  tx1 <- df %>% lm(dv ~ married + mod + age + Years_PrimaryPartner + age*married, data = .)

  
  tx1 <- xtable(tx1)
  colnames(tx1)[colnames(tx1)=="Pr(>|t|)"] <- "p_value"
    colnames(tx1)[colnames(tx1)=="t value"] <- "t_value"

  
  tx1 <- tx1 %>%
    mutate(p_value = round(p_value, 4)) %>%
    mutate(t_value = round(t_value, 3)) %>%
    mutate(p_value= cell_spec(p_value, "html", background = ifelse(p_value < .01, "gold", "white"))) %>%
    mutate(t_value= cell_spec(t_value, "html", background = ifelse(t_value < -2.5, "#FF6347", 
                                                                   ifelse(t_value > 2.5, "lightgreen", "white"))))

  
  rownames(tx1) <- c("Intercept", "Married: True", modname, "Age (years)", "Duration", "Married X Age")
  
kable(tx1, row.names= T, align=c("l", "l", "r", "r")  ,
            booktabs=TRUE, escape = F) %>% 
    kable_styling(font_size=8) 
  }

Looking at modertators interaction with marriage

  ireg_just_mod_i <- function(dv, df, mod, modname){
    
      dv <- as.numeric(dv)
  tx1 <- df %>% lm(dv ~ married + mod + married*mod, data = .)

  
  tx1 <- xtable(tx1)
  colnames(tx1)[colnames(tx1)=="Pr(>|t|)"] <- "p_value"
    colnames(tx1)[colnames(tx1)=="t value"] <- "t_value"

  
  tx1 <- tx1 %>%
    mutate(p_value = round(p_value, 4)) %>%
    mutate(t_value = round(t_value, 3)) %>%
    mutate(p_value= cell_spec(p_value, "html", background = ifelse(p_value < .01, "gold", "white"))) %>%
    mutate(t_value= cell_spec(t_value, "html", background = ifelse(t_value < -2.5, "#FF6347", 
                                                                   ifelse(t_value > 2.5, "lightgreen", "white"))))

  
  rownames(tx1) <- c("Intercept", "Married: True", modname, paste("Married X", modname))
  
kable(tx1, row.names= T, align=c("l", "l", "r", "r", "r", "r")  ,
            booktabs=TRUE, escape = F) %>% 
    kable_styling(font_size=8) 
    
  }
  
#############################################################################################################################################################################################################################################################
  ireg_full_control <- function(dv, df, mod, modname){
     
     dv <- as.numeric(dv)
       tx1 <- df %>% lm(dv ~ married + mod + age + Years_PrimaryPartner + MALE + married*mod, data = .)
  
      
  tx1 <- xtable(tx1)
  colnames(tx1)[colnames(tx1)=="Pr(>|t|)"] <- "p_value"
    colnames(tx1)[colnames(tx1)=="t value"] <- "t_value"

  
  tx1 <- tx1 %>%
    mutate(p_value = round(p_value, 4)) %>%
    mutate(t_value = round(t_value, 3)) %>%
    mutate(p_value= cell_spec(p_value, "html", background = ifelse(p_value < .01, "gold", "white"))) %>%
    mutate(t_value= cell_spec(t_value, "html", background = ifelse(t_value < -2.5, "#FF6347", 
                                                                   ifelse(t_value > 2.5, "lightgreen", "white"))))

  
  rownames(tx1) <- c("Intercept", "Married: True", modname, "Age (years)", "Duration", "Male",  paste("Married X", modname))
  
kable(tx1, row.names= T, align=c("l", "l", "r", "r", "r", "r")  ,
            booktabs=TRUE, escape = F) %>% 
    kable_styling(font_size=8) 
    
  
    
  }


 


#############################################################################################################################################################################################################################################################
  ireg_full_control_i <- function(dv, df, mod, modname){
    
          dv <- as.numeric(dv)
  tx1 <- df %>% lm(dv ~ married + mod + age + Years_PrimaryPartner + MALE + age*married + married*mod, data = .)

  
  tx1 <- xtable(tx1)
  colnames(tx1)[colnames(tx1)=="Pr(>|t|)"] <- "p_value"
    colnames(tx1)[colnames(tx1)=="t value"] <- "t_value"

  
  tx1 <- tx1 %>%
    mutate(p_value = round(p_value, 4)) %>%
    mutate(t_value = round(t_value, 3)) %>%
    mutate(p_value= cell_spec(p_value, "html", background = ifelse(p_value < .01, "gold", "white"))) %>%
    mutate(t_value= cell_spec(t_value, "html", background = ifelse(t_value < -2.5, "#FF6347", 
                                                                   ifelse(t_value > 2.5, "lightgreen", "white"))))

  
  rownames(tx1) <- c("Intercept", "Married: True", modname, "Age (years)", "Duration", "Male", "Married X Age",  paste("Married X", modname))
  
kable(tx1, row.names= T, align=c("l", "l", "r", "r", "r", "r")  ,
            booktabs=TRUE, escape = F) %>% 
    kable_styling(font_size=8) 
  }
  
  
  
   
    
    #############################################################################################################################################################################################################################################################
   #For subsets wheere we can't use all controls
    
    #############################################################################################################################################################################################################################################################
    
     ireg_full_control_gend <- function(dv, df, mod, modname){

    
      dv <- as.numeric(dv)
      
       tx1 <- df %>% lm(dv ~ married + mod + age + Years_PrimaryPartner + married*mod, data = .)
  
      
  tx1 <- xtable(tx1)
  colnames(tx1)[colnames(tx1)=="Pr(>|t|)"] <- "p_value"
    colnames(tx1)[colnames(tx1)=="t value"] <- "t_value"

  
  tx1 <- tx1 %>%
    mutate(p_value = round(p_value, 4)) %>%
    mutate(t_value = round(t_value, 3)) %>%
    mutate(p_value= cell_spec(p_value, "html", background = ifelse(p_value < .01, "gold", "white"))) %>%
    mutate(t_value= cell_spec(t_value, "html", background = ifelse(t_value < -2.5, "#FF6347", 
                                                                   ifelse(t_value > 2.5, "lightgreen", "white"))))

  
  rownames(tx1) <- c("Intercept", "Married: True", modname, "Age (years)", "Duration",  paste("Married X", modname))
  
kable(tx1, row.names= T, align=c("l", "l", "r", "r",  "r")  ,
            booktabs=TRUE, escape = F) %>% 
    kable_styling(font_size=8) 
    
  
    
     }

 ireg_full_control_gend_i <- function(dv, df, mod, modname){
    
          dv <- as.numeric(dv)
  tx1 <- df %>% lm(dv ~ married + mod + age + Years_PrimaryPartner + age*married + married*mod, data = .)

  
  tx1 <- xtable(tx1)
  colnames(tx1)[colnames(tx1)=="Pr(>|t|)"] <- "p_value"
    colnames(tx1)[colnames(tx1)=="t value"] <- "t_value"

  
  tx1 <- tx1 %>%
    mutate(p_value = round(p_value, 4)) %>%
    mutate(t_value = round(t_value, 3)) %>%
    mutate(p_value= cell_spec(p_value, "html", background = ifelse(p_value < .01, "gold", "white"))) %>%
    mutate(t_value= cell_spec(t_value, "html", background = ifelse(t_value < -2.5, "#FF6347", 
                                                                   ifelse(t_value > 2.5, "lightgreen", "white"))))

  
  rownames(tx1) <- c("Intercept", "Married: True", modname, "Age (years)", "Duration", "Married X Age",  paste("Married X", modname))
  
kable(tx1, row.names= T, align=c("l", "l", "r", "r", "r")  ,
            booktabs=TRUE, escape = F) %>% 
    kable_styling(font_size=8) 
  }

Marriage on Want/Age/Like without mediators, with or without controls, for comparison

Want - Marriage

reg_no_mod(sex_data$want, sex_data )
Estimate Std. Error t_value p_value
Intercept 28.927462 0.2358428 122.656 0
Married: True -5.062436 0.2804827 -18.049 0

Like - Marriage

reg_no_mod(sex_data$totlike, sex_data )
Estimate Std. Error t_value p_value
Intercept 38.524460 0.2654955 145.104 0
Married: True -3.954296 0.3168241 -12.481 0

Frequency - Marriage

reg_no_mod(sex_data$freq_num, sex_data)
Estimate Std. Error t_value p_value
Intercept 3.6641623 0.0408283 89.746 0
Married: True -0.6595098 0.0480844 -13.716 0

Want - Marriage, controls

reg_no_mod_control(sex_data$want, sex_data )
Estimate Std. Error t_value p_value
Intercept 33.6515234 0.3616805 93.042 0
Married: TRUE -2.4498192 0.2836310 -8.637 0
Age -0.1788330 0.0079330 -22.543 0
Duration -0.0164498 0.0049803 -3.303 0.001
MALE 4.5428634 0.2430139 18.694 0

Like - Marriage, controls

reg_no_mod_control(sex_data$totlike, sex_data)
Estimate Std. Error t_value p_value
Intercept 40.9088281 0.4368889 93.637 0
Married: TRUE -2.6911441 0.3412552 -7.886 0
Age -0.0852356 0.0095901 -8.888 0
Duration -0.0098875 0.0058960 -1.677 0.0936
MALE 1.9027594 0.2944406 6.462 0

Frequency - Marriage, controls

reg_no_mod_control(sex_data$freq_num, sex_data)
Estimate Std. Error t_value p_value
Intercept 4.8698702 0.0640338 76.052 0
Married: TRUE -0.1485242 0.0488622 -3.04 0.0024
Age -0.0334322 0.0014244 -23.471 0
Duration -0.0032137 0.0010801 -2.975 0.0029
MALE 0.2339988 0.0411009 5.693 0

Masturbation Correlates With Wanting, But Doesn’t Change Marriage Effect For Any Outcome

Want Graphs

bin_graphs_want(sex_data, sex_data$Masturbation, "Masturbation Binary", c("Does Masturbate", "Doesn't Masturbate"),  
                     c("Unmarried, Does", "Married, Does", "Unmarried, Doesn't", "Married, Doesn't"))

Like Graphs

bin_graphs_like(sex_data, sex_data$Masturbation, "Masturbation Binary", c("Does Masturbate", "Doesn't Masturbate"),  
                     c("Unmarried, Does", "Married, Does", "Unmarried, Doesn't", "Married, Doesn't"))

Frequency Graphs

bin_graphs_freq(sex_data, sex_data$Masturbation, "Masturbation Binary", c("Does Masturbate", "Doesn't Masturbate"),  
                     c("Unmarried, Does", "Married, Does", "Unmarried, Doesn't", "Married, Doesn't"))

Want - Only Masturbates

reg_just_mod_i(sex_data$want, sex_data, sex_data$Masturbation, "Masturbates")
Estimate Std. Error t_value p_value
Intercept 25.713283 0.4207056 61.119 0
Married: True -4.832764 0.3882385 -12.448 0
Masturbates 3.509673 0.3896280 9.008 0

Want – Full Controls

reg_full_control_gend(sex_data$want, sex_data, sex_data$Masturbation, "Masturbates")
Estimate Std. Error t_value p_value
Intercept 31.6357836 0.5937128 53.285 0
Married: True -2.3241751 0.4173741 -5.569 0
Masturbates 3.0708399 0.3757931 8.172 0
Age (years) -0.1462420 0.0110613 -13.221 0
Duration -0.0092792 0.0054456 -1.704 0.0885

Like - Only Masturbates

reg_just_mod_i(sex_data$totlike, sex_data, sex_data$Masturbation, "Masturbates")
Estimate Std. Error t_value p_value
Intercept 37.897542 0.4767215 79.496 0
Married: True -3.883481 0.4398593 -8.829 0
Masturbates 0.213616 0.4447252 0.48 0.631

Like – Full Controls

reg_full_control_gend(sex_data$totlike, sex_data, sex_data$Masturbation, "Masturbates")
Estimate Std. Error t_value p_value
Intercept 40.5204466 0.6978172 58.067 0
Married: True -2.8094235 0.4877010 -5.761 0
Masturbates 0.0061784 0.4441115 0.014 0.9889
Age (years) -0.0647526 0.0129863 -4.986 0
Duration -0.0034569 0.0062795 -0.551 0.582

Frequency - Only Masturbates

reg_just_mod_i(sex_data$freq_num, sex_data, sex_data$Masturbation, "Masturbates")
Estimate Std. Error t_value p_value
Intercept 3.5492972 0.0727877 48.762 0
Married: True -0.7372743 0.0672972 -10.956 0
Masturbates 0.0600030 0.0666479 0.9 0.3681

Frequency – Full Controls

reg_full_control_gend(sex_data$freq_num, sex_data, sex_data$Masturbation, "Masturbates")
Estimate Std. Error t_value p_value
Intercept 4.7746206 0.1026428 46.517 0
Married: True -0.2341212 0.0713455 -3.282 0.001
Masturbates -0.0256017 0.0631884 -0.405 0.6854
Age (years) -0.0297049 0.0019449 -15.273 0
Duration -0.0017873 0.0012219 -1.463 0.1437

Controlling For Masturbation Frequency Strengthens Marriage Effects Slightly

Graphs

# (6 - desire )because scale is reverse
sex_data$MastFreqNum = 6-  as.numeric(sex_data$MasturbationFreq)

contsmall(sex_data, sex_data$MastFreqNum, "Masturbation Frequency", "")

Want - Only Masturbation Frequency

reg_just_mod_i(sex_data$want, sex_data, sex_data$MastFreqNum, "Masturbation Frequency")
Estimate Std. Error t_value p_value
Intercept 23.828069 0.6476797 36.79 0
Married: True -4.261849 0.4556931 -9.352 0
Masturbation Frequency 1.894929 0.1870059 10.133 0

Want – Full Controls

reg_full_control(sex_data$want, sex_data, sex_data$MastFreqNum, "Masturbation Frequency")
Estimate Std. Error t_value p_value
Intercept 29.9168012 0.8782980 34.062 0
Married: True -2.4248481 0.4897959 -4.951 0
Masturbation Frequency 1.2841080 0.1921966 6.681 0
Age (years) -0.1399572 0.0142508 -9.821 0
Duration -0.0113385 0.0073318 -1.546 0.1222
Male 2.1480876 0.4725876 4.545 0

Like - Only Masturbation Frequency

reg_just_mod_i(sex_data$totlike, sex_data, sex_data$MastFreqNum,"Masturbation Frequency")
Estimate Std. Error t_value p_value
Intercept 37.6440001 0.7469046 50.4 0
Married: True -4.3094520 0.5236447 -8.23 0
Masturbation Frequency 0.2654942 0.2149702 1.235 0.217

Like – Full Controls

reg_full_control(sex_data$totlike,sex_data, sex_data$MastFreqNum, "Masturbation Frequency")
Estimate Std. Error t_value p_value
Intercept 41.0565500 1.0312607 39.812 0
Married: True -3.2370843 0.5757667 -5.622 0
Masturbation Frequency -0.0610910 0.2263510 -0.27 0.7873
Age (years) -0.0775992 0.0167022 -4.646 0
Duration -0.0088210 0.0085021 -1.038 0.2997
Male 1.0413703 0.5556341 1.874 0.0611

Frequency - Only Masturbation Frequency

reg_just_mod_i(sex_data$freq_num, sex_data, sex_data$MastFreqNum, "Masturbation Frequency")
Estimate Std. Error t_value p_value
Intercept 3.3551771 0.1126418 29.786 0
Married: True -0.7589831 0.0796163 -9.533 0
Masturbation Frequency 0.1027011 0.0331603 3.097 0.002

Frequency – Full Controls

reg_full_control(sex_data$freq_num, sex_data, sex_data$MastFreqNum, "Masturbation Frequency")
Estimate Std. Error t_value p_value
Intercept 4.5689407 0.1518618 30.086 0
Married: True -0.1413652 0.0908218 -1.557 0.1198
Masturbation Frequency -0.0007456 0.0329361 -0.023 0.9819
Age (years) -0.0234004 0.0028664 -8.164 0
Duration -0.0163969 0.0035609 -4.605 0
Male 0.1266775 0.0802366 1.579 0.1146

Generally, Faking Orgasm Doesn’t Account for Marriage Effect, But Frequent Fakers Dislike Sex Whether Or Not They Are Married

Graphs

sex_data$FakeOrgNum = as.numeric(sex_data$FakeOrgasm)

contsmall(sex_data, sex_data$FakeOrgNum, "Orgasm Faking Frequency", "")

Want - Only Orgasm Faking

reg_just_mod_i(sex_data$want, sex_data, sex_data$FakeOrgNum, "Orgasm Faking Frequency")
Estimate Std. Error t_value p_value
Intercept 29.746179 0.4542020 65.491 0
Married: True -5.445533 0.3903286 -13.951 0
Orgasm Faking Frequency -1.021436 0.2383273 -4.286 0

Want – Full Controls

reg_full_control(sex_data$want, sex_data, sex_data$FakeOrgNum, "Orgasm Faking Frequency")
Estimate Std. Error t_value p_value
Intercept 35.3801796 0.6210873 56.965 0
Married: True -2.6370829 0.4075799 -6.47 0
Orgasm Faking Frequency -1.0339689 0.2254665 -4.586 0
Age (years) -0.1911471 0.0112611 -16.974 0
Duration -0.0061278 0.0053458 -1.146 0.2518
Male 4.1453354 0.3671072 11.292 0

Like - Only Orgasm Faking

reg_just_mod_i(sex_data$totlike, sex_data, sex_data$FakeOrgNum,"Orgasm Faking Frequency")
Estimate Std. Error t_value p_value
Intercept 41.685952 0.4969993 83.875 0
Married: True -4.209796 0.4266210 -9.868 0
Orgasm Faking Frequency -2.590407 0.2603343 -9.95 0

Like – Full Controls

reg_full_control(sex_data$totlike,sex_data, sex_data$FakeOrgNum, "Orgasm Faking Frequency")
Estimate Std. Error t_value p_value
Intercept 44.6589220 0.7216664 61.883 0
Married: True -2.9397474 0.4728434 -6.217 0
Orgasm Faking Frequency -2.6565030 0.2621482 -10.134 0
Age (years) -0.0910808 0.0130586 -6.975 0
Duration 0.0014874 0.0061243 0.243 0.8081
Male 1.3912883 0.4273255 3.256 0.0011

Frequency - Only Orgasm Faking

reg_just_mod_i(sex_data$freq_num, sex_data, sex_data$FakeOrgNum, "Orgasm Faking Frequency")
Estimate Std. Error t_value p_value
Intercept 3.4731091 0.0787276 44.116 0
Married: True -0.7243116 0.0669104 -10.825 0
Orgasm Faking Frequency 0.0898590 0.0420751 2.136 0.0328

Frequency – Full Controls

reg_full_control(sex_data$freq_num, sex_data, sex_data$FakeOrgNum, "Orgasm Faking Frequency")
Estimate Std. Error t_value p_value
Intercept 4.6483460 0.1106267 42.018 0
Married: True -0.2228745 0.0712392 -3.129 0.0018
Orgasm Faking Frequency 0.0508237 0.0405494 1.253 0.2102
Age (years) -0.0308910 0.0020260 -15.248 0
Duration -0.0015573 0.0012184 -1.278 0.2013
Male 0.2108186 0.0638475 3.302 0.001

Lube Doesn’t Offset Marriage Effect, But Interacts In Interesting Ways

Graphs

sex_data$LubeNum = as.numeric(sex_data$lube)

contsmall(sex_data, sex_data$LubeNum, "Lube Use Frequency", "")

Want - Only Masturbation Frequency

reg_just_mod_i(sex_data$want, sex_data, sex_data$LubeNum, "Lube Use Frequency")
Estimate Std. Error t_value p_value
Intercept 28.1249776 0.3240067 86.804 0
Married: True -4.9052735 0.2855114 -17.181 0
Lube Use Frequency 0.4287085 0.1013284 4.231 0

Want – Full Controls

reg_full_control(sex_data$want, sex_data, sex_data$LubeNum, "Lube Use Frequency")
Estimate Std. Error t_value p_value
Intercept 32.5068844 0.4134712 78.619 0
Married: True -2.4038534 0.2885690 -8.33 0
Lube Use Frequency 0.5442508 0.0940628 5.786 0
Age (years) -0.1759847 0.0081142 -21.688 0
Duration -0.0162218 0.0049805 -3.257 0.0011
Male 4.4808710 0.2487751 18.012 0

Like - Only Masturbation Frequency

reg_just_mod_i(sex_data$totlike, sex_data, sex_data$LubeNum,"Lube Use Frequency")
Estimate Std. Error t_value p_value
Intercept 37.5333572 0.3594896 104.407 0
Married: True -3.9572115 0.3167785 -12.492 0
Lube Use Frequency 0.4554106 0.1124252 4.051 1e-04

Like – Full Controls

reg_full_control(sex_data$totlike,sex_data, sex_data$LubeNum, "Lube Use Frequency")
Estimate Std. Error t_value p_value
Intercept 39.8547714 0.4887817 81.539 0
Married: True -2.6575331 0.3411295 -7.79 0
Lube Use Frequency 0.5178601 0.1111956 4.657 0
Age (years) -0.0870408 0.0095922 -9.074 0
Duration -0.0105475 0.0058877 -1.791 0.0733
Male 1.9009603 0.2940875 6.464 0

Frequency - Only Masturbation Frequency

reg_just_mod_i(sex_data$freq_num, sex_data, sex_data$LubeNum, "Lube Use Frequency")
Estimate Std. Error t_value p_value
Intercept 3.4119269 0.0545293 62.571 0
Married: True -0.6357592 0.0482201 -13.185 0
Lube Use Frequency 0.1312485 0.0169472 7.745 0

Frequency – Full Controls

reg_full_control(sex_data$freq_num, sex_data, sex_data$LubeNum, "Lube Use Frequency")
Estimate Std. Error t_value p_value
Intercept 4.5288613 0.0712203 63.59 0
Married: True -0.1462357 0.0488291 -2.995 0.0028
Lube Use Frequency 0.1612277 0.0157072 10.265 0
Age (years) -0.0328129 0.0014306 -22.937 0
Duration -0.0032100 0.0010613 -3.025 0.0025
Male 0.2306529 0.0414256 5.568 0

Drugs Doesn’t Offset Marriage Effect, But Interacts In Interesting Ways

Graphs

sex_data$DrugNum = as.numeric(sex_data$drugs)

contsmall(sex_data, sex_data$DrugNum, "Potency-Enhacncing Drug Use Frequency", "")

Want - Only Drug Use

reg_just_mod_i(sex_data$want, sex_data, sex_data$DrugNum, "Drug Use Frequency")
Estimate Std. Error t_value p_value
Intercept 29.1259287 0.3034984 95.967 0
Married: True -4.8888789 0.2862352 -17.08 0
Drug Use Frequency -0.0563525 0.1366889 -0.412 0.6802

Want – Full Controls

reg_full_control(sex_data$want, sex_data, sex_data$DrugNum, "Drug Use Frequency")
Estimate Std. Error t_value p_value
Intercept 33.2787578 0.3897049 85.395 0
Married: True -2.4113851 0.2894974 -8.33 0
Drug Use Frequency 0.3240472 0.1289948 2.512 0.012
Age (years) -0.1769679 0.0082276 -21.509 0
Duration -0.0155739 0.0049935 -3.119 0.0018
Male 4.4680834 0.2497531 17.89 0

Like - Only Drug Use

reg_just_mod_i(sex_data$totlike, sex_data, sex_data$DrugNum,"Drug Use Frequency")
Estimate Std. Error t_value p_value
Intercept 38.6785266 0.3366652 114.887 0
Married: True -3.9351491 0.3175153 -12.394 0
Drug Use Frequency -0.1199988 0.1516265 -0.791 0.4287

Like – Full Controls

reg_full_control(sex_data$totlike,sex_data, sex_data$DrugNum, "Drug Use Frequency")
Estimate Std. Error t_value p_value
Intercept 40.8045045 0.4604050 88.627 0
Married: True -2.6802903 0.3420179 -7.837 0
Drug Use Frequency 0.0799457 0.1523970 0.525 0.5999
Age (years) -0.0857264 0.0097202 -8.819 0
Duration -0.0098698 0.0058994 -1.673 0.0944
Male 1.9093453 0.2950632 6.471 0

Frequency - Only Drug Use

reg_just_mod_i(sex_data$freq_num, sex_data, sex_data$DrugNum, "Drug Use Frequency")
Estimate Std. Error t_value p_value
Intercept 3.7344416 0.0514037 72.649 0
Married: True -0.6275255 0.0485841 -12.916 0
Drug Use Frequency -0.0313924 0.0230976 -1.359 0.1742

Frequency – Full Controls

reg_full_control(sex_data$freq_num, sex_data, sex_data$DrugNum, "Drug Use Frequency")
Estimate Std. Error t_value p_value
Intercept 4.7820035 0.0676208 70.718 0
Married: True -0.1518016 0.0493492 -3.076 0.0021
Drug Use Frequency 0.0727476 0.0218678 3.327 9e-04
Age (years) -0.0329764 0.0014652 -22.506 0
Duration -0.0028108 0.0010722 -2.621 0.0088
Male 0.2260370 0.0418982 5.395 0

More Previous Sex Partners Decreases Marriage’s Effect On Want, Increases Effect On Like

Graphs

nooutlier_sexpartners <- sex_data[sex_data$howmany < 50,]

contsmall(nooutlier_sexpartners, nooutlier_sexpartners$howmany, "Number Of Previous Sex Partners", "")

Want - Only Sex Partners

reg_just_mod_i(nooutlier_sexpartners$want, nooutlier_sexpartners, nooutlier_sexpartners$howmany, "Sex Partners")
Estimate Std. Error t_value p_value
Intercept 27.7109286 0.5665457 48.912 0
Married: True -4.6364867 0.6415684 -7.227 0
Sex Partners 0.1588474 0.0691162 2.298 0.0218

Want – Full Controls

reg_full_control(nooutlier_sexpartners$want, nooutlier_sexpartners, nooutlier_sexpartners$howmany, " Sex Partners")
Estimate Std. Error t_value p_value
Intercept 30.2471210 1.0530463 28.723 0
Married: True -1.5196466 0.7502283 -2.026 0.0431
Sex Partners 0.1618124 0.0663974 2.437 0.015
Age (years) -0.1018521 0.0268054 -3.8 2e-04
Duration -0.1100553 0.0312582 -3.521 5e-04
Male 4.1140395 0.6596097 6.237 0

Like - Only Sex Partners

reg_just_mod_i(nooutlier_sexpartners$totlike, nooutlier_sexpartners, nooutlier_sexpartners$howmany,"Sex Partners")
Estimate Std. Error t_value p_value
Intercept 36.9496110 0.6224055 59.366 0
Married: True -5.2361789 0.7048252 -7.429 0
Sex Partners -0.0348543 0.0759308 -0.459 0.6463

Like – Full Controls

reg_full_control(nooutlier_sexpartners$totlike,nooutlier_sexpartners, nooutlier_sexpartners$howmany, "Sex Partners")
Estimate Std. Error t_value p_value
Intercept 38.0222937 1.2131083 31.343 0
Married: True -3.7555878 0.8642623 -4.345 0
Sex Partners -0.0339220 0.0764898 -0.443 0.6575
Age (years) -0.0442488 0.0308797 -1.433 0.1522
Duration -0.0546437 0.0360094 -1.517 0.1295
Male 1.9214457 0.7598697 2.529 0.0116

Frequency - Only Sex Partners

reg_just_mod_i(nooutlier_sexpartners$freq_num, nooutlier_sexpartners, nooutlier_sexpartners$howmany, "Sex Partners")
Estimate Std. Error t_value p_value
Intercept 3.6030382 0.0954659 37.742 0
Married: True -0.6810235 0.1068685 -6.373 0
Sex Partners -0.0047984 0.0117928 -0.407 0.6842

Frequency – Full Controls

reg_full_control(nooutlier_sexpartners$freq_num, nooutlier_sexpartners, nooutlier_sexpartners$howmany, "Sex Partners")
Estimate Std. Error t_value p_value
Intercept 4.2962107 0.1829015 23.489 0
Married: True -0.1774571 0.1251693 -1.418 0.1567
Sex Partners 0.0003797 0.0113923 0.033 0.9734
Age (years) -0.0185144 0.0045396 -4.078 1e-04
Duration -0.0171612 0.0051101 -3.358 8e-04
Male 0.3779989 0.1108539 3.41 7e-04

More Previous Sex Partners Decreases Marriage’s Effect On Want, Increases Effect On Like

Graphs

nooutlier_sexpartners <- sex_data[sex_data$howmany < 50,]

contsmall(nooutlier_sexpartners, nooutlier_sexpartners$howmany, "Number Of Previous Sex Partners", "")

Want - Only Sex Partners

reg_just_mod_i(nooutlier_sexpartners$want, nooutlier_sexpartners, nooutlier_sexpartners$howmany, "Sex Partners")
Estimate Std. Error t_value p_value
Intercept 27.7109286 0.5665457 48.912 0
Married: True -4.6364867 0.6415684 -7.227 0
Sex Partners 0.1588474 0.0691162 2.298 0.0218

Want – Full Controls

reg_full_control(nooutlier_sexpartners$want, nooutlier_sexpartners, nooutlier_sexpartners$howmany, " Sex Partners")
Estimate Std. Error t_value p_value
Intercept 30.2471210 1.0530463 28.723 0
Married: True -1.5196466 0.7502283 -2.026 0.0431
Sex Partners 0.1618124 0.0663974 2.437 0.015
Age (years) -0.1018521 0.0268054 -3.8 2e-04
Duration -0.1100553 0.0312582 -3.521 5e-04
Male 4.1140395 0.6596097 6.237 0

Like - Only Sex Partners

reg_just_mod_i(nooutlier_sexpartners$totlike, nooutlier_sexpartners, nooutlier_sexpartners$howmany,"Sex Partners")
Estimate Std. Error t_value p_value
Intercept 36.9496110 0.6224055 59.366 0
Married: True -5.2361789 0.7048252 -7.429 0
Sex Partners -0.0348543 0.0759308 -0.459 0.6463

Like – Full Controls

reg_full_control(nooutlier_sexpartners$totlike,nooutlier_sexpartners, nooutlier_sexpartners$howmany, "Sex Partners")
Estimate Std. Error t_value p_value
Intercept 38.0222937 1.2131083 31.343 0
Married: True -3.7555878 0.8642623 -4.345 0
Sex Partners -0.0339220 0.0764898 -0.443 0.6575
Age (years) -0.0442488 0.0308797 -1.433 0.1522
Duration -0.0546437 0.0360094 -1.517 0.1295
Male 1.9214457 0.7598697 2.529 0.0116

Frequency - Only Sex Partners

reg_just_mod_i(nooutlier_sexpartners$freq_num, nooutlier_sexpartners, nooutlier_sexpartners$howmany, "Sex Partners")
Estimate Std. Error t_value p_value
Intercept 3.6030382 0.0954659 37.742 0
Married: True -0.6810235 0.1068685 -6.373 0
Sex Partners -0.0047984 0.0117928 -0.407 0.6842

Frequency – Full Controls

reg_full_control(nooutlier_sexpartners$freq_num, nooutlier_sexpartners, nooutlier_sexpartners$howmany, "Sex Partners")
Estimate Std. Error t_value p_value
Intercept 4.2962107 0.1829015 23.489 0
Married: True -0.1774571 0.1251693 -1.418 0.1567
Sex Partners 0.0003797 0.0113923 0.033 0.9734
Age (years) -0.0185144 0.0045396 -4.078 1e-04
Duration -0.0171612 0.0051101 -3.358 8e-04
Male 0.3779989 0.1108539 3.41 7e-04