Reading in Data
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)
jrothsch_theme <- theme_bw() +
theme(text = element_text(size = 16, 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=10), plot.subtitle = element_text(size=14, face="italic", color="black"))
Creating variables
sex_data <- sex_data %>%
mutate(married = status == "Married")
sex_data <- sex_data %>% mutate(sex_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))))))))
Creating summarized datasets
clean_sd <- sex_data[!is.na(sex_data$status),]
clean_sd <- clean_sd[!is.na(clean_sd$want),]
clean_sd <- clean_sd[!is.na(clean_sd$totlike),]
clean_sd <- clean_sd[!is.na(clean_sd$sexfreq),]
clean_sd <- clean_sd[clean_sd$Years_PrimaryPartner < 100,]
clean_sd <- clean_sd[!is.na(clean_sd$duration),]
summary_cat <- clean_sd %>%
group_by(status) %>%
summarise(wantavg = mean(want), sdwant = sd(want),
like = mean(totlike), sdlike = sd(totlike),
freq = mean(sex_freq_num), sdfreq= sd(sex_freq_num),
len = length(totlike))
summary_bin <- clean_sd %>%
group_by(married) %>%
summarise(wantavg = mean(want), sdwant = sd(want),
like = mean(totlike), sdlike = sd(totlike),
freq = mean(sex_freq_num), sdfreq = sd(sex_freq_num),
len = length(totlike))
summary_cat <- summary_cat %>%
mutate(sewant = sdwant/sqrt(len),
selike = sdlike/sqrt(len),
sefreq = sdfreq/sqrt(len))
summary_bin <- summary_bin %>%
mutate(sewant = sdwant/sqrt(len),
selike = sdlike/sqrt(len),
sefreq = sdfreq/sqrt(len))
ggplot(data = summary_bin, aes(x = married, y = like)) +
geom_bar(stat = 'identity',position = "dodge", fill = "black", color = "black") +
geom_errorbar(aes(ymin= like - selike*2, ymax = like + selike*2 ), color = 'red', width = .25) +
geom_text(aes(label = round(like, digits = 2)), nudge_y = -4, color = "white") + jrothsch_theme +
labs(title = "Sex Liking by Marriage Binary", x = "", y = "Average Like Score") + scale_x_discrete(labels = c("Unmarried", "Married"))
ggplot(data = summary_bin, aes(x = married, y = wantavg)) +
geom_bar(stat = 'identity',position = "dodge", fill = "black", color = "black") +
geom_errorbar(aes(ymin= wantavg - sewant*2, ymax = wantavg + sewant*2 ), color = 'red', width = .25) +
geom_text(aes(label = round(wantavg, digits = 2)), nudge_y = - 3, color = "white") + jrothsch_theme +
labs(title = "Sex Wanting by Marriage Binary", x = "", y = "Average Want Score") + scale_x_discrete(labels = c("Unmarried", "Married"))
ggplot(data = summary_bin, aes(x = married, y = freq)) +
geom_bar(stat = 'identity',position = "dodge", fill = "black", color = "black") +
geom_errorbar(aes(ymin= freq - sefreq*2, ymax = freq + sefreq*2 ), color = 'red', width = .25) +
geom_text(aes(label = round(freq, digits = 2)), nudge_y = -.3, color = "white") + jrothsch_theme +
labs(title = "Sex Frequency by Marriage Binary", x = "", y = "Average Frequency Score") + scale_x_discrete(labels = c("Unmarried", "Married"))
ggplot(data = summary_cat, aes(x = status, y = like)) +
geom_bar(stat = 'identity',position = "dodge", fill = "black", color = "black") +
geom_errorbar(aes(ymin= like - selike*2, ymax = like + selike*2 ), color = 'red', width = .25) +
geom_text(aes(label = round(like, digits = 2)), nudge_y = -4, color = "white") + jrothsch_theme +
labs(title = "Sex Liking by ", x = "", y = "Average Like Score")
ggplot(data = summary_cat, aes(x = status, y = wantavg)) + geom_bar(stat = 'identity',position = "dodge", fill = "black", color = "black") + geom_errorbar(aes(ymin= wantavg - sewant*2, ymax = wantavg + sewant*2 ), color = 'red', width = .25) + geom_text(aes(label = round(like, digits = 2)), nudge_y = -3, color = "white") + jrothsch_theme +
labs(title = "Sex Wanting by ", x = "", y = "Average Want Score")
ggplot(data = summary_cat, aes(x = status, y = freq)) + geom_bar(stat = 'identity',position = "dodge", fill = "black", color = "black") + geom_errorbar(aes(ymin= freq - sefreq*2, ymax = freq + sefreq*2 ), color = 'red', width = .25) +
geom_text(aes(label = round(like, digits = 2)), nudge_y = -.3, color = "white") + jrothsch_theme +
labs(title = "Sex Frequency by ", x = "Married", y = "Average Want Score")
want_status <-sex_data %>%
lm(want~status, .)
summary(want_status)
##
## Call:
## lm(formula = want ~ status, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -22.9924 -6.0521 0.0826 6.3979 21.1188
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 23.8812 0.1503 158.912 < 2e-16 ***
## statusCohabiting 3.8208 0.3676 10.394 < 2e-16 ***
## statusDating 6.6362 0.3550 18.694 < 2e-16 ***
## statusSeparated 3.7142 1.2903 2.879 0.004010 **
## statusDivorced 4.1505 1.2081 3.436 0.000596 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.97 on 5156 degrees of freedom
## (2397 observations deleted due to missingness)
## Multiple R-squared: 0.0736, Adjusted R-squared: 0.07288
## F-statistic: 102.4 on 4 and 5156 DF, p-value: < 2.2e-16
want_married <-sex_data %>%
lm(want~married, .)
summary(want_married)
##
## Call:
## lm(formula = want ~ married, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -21.5560 -6.0312 0.0938 6.5188 21.1188
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 29.0810 0.2252 129.15 <2e-16 ***
## marriedTRUE -5.1998 0.2710 -19.19 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.002 on 5159 degrees of freedom
## (2397 observations deleted due to missingness)
## Multiple R-squared: 0.0666, Adjusted R-squared: 0.06642
## F-statistic: 368.1 on 1 and 5159 DF, p-value: < 2.2e-16
like_status<-sex_data %>%
lm(totlike~status, .)
summary(like_status)
##
## Call:
## lm(formula = totlike ~ status, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -27.332 -7.114 1.402 7.886 15.402
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 34.5978 0.1710 202.358 < 2e-16 ***
## statusCohabiting 2.7345 0.4145 6.597 4.66e-11 ***
## statusDating 5.5166 0.4004 13.778 < 2e-16 ***
## statusSeparated 3.8567 1.4976 2.575 0.01005 *
## statusDivorced 3.6522 1.3299 2.746 0.00605 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.869 on 4853 degrees of freedom
## (2700 observations deleted due to missingness)
## Multiple R-squared: 0.04223, Adjusted R-squared: 0.04145
## F-statistic: 53.5 on 4 and 4853 DF, p-value: < 2.2e-16
like_married <-sex_data %>%
lm(totlike~married, .)
summary(like_married)
##
## Call:
## lm(formula = totlike ~ married, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -28.753 -7.598 1.247 8.247 15.402
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 38.7529 0.2533 152.99 <2e-16 ***
## marriedTRUE -4.1551 0.3059 -13.59 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.895 on 4856 degrees of freedom
## (2700 observations deleted due to missingness)
## Multiple R-squared: 0.03661, Adjusted R-squared: 0.03642
## F-statistic: 184.6 on 1 and 4856 DF, p-value: < 2.2e-16
freq_status<-sex_data %>%
lm(sex_freq_num~status, .)
summary(freq_status)
##
## Call:
## lm(formula = sex_freq_num ~ status, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.7287 -0.7287 0.2713 0.9931 1.9931
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.00686 0.02508 119.906 < 2e-16 ***
## statusCohabiting 0.69571 0.06297 11.049 < 2e-16 ***
## statusDating 0.72183 0.06125 11.785 < 2e-16 ***
## statusSeparated 0.01487 0.22005 0.068 0.94611
## statusDivorced 0.53017 0.20332 2.608 0.00915 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.483 on 4954 degrees of freedom
## (2599 observations deleted due to missingness)
## Multiple R-squared: 0.04397, Adjusted R-squared: 0.0432
## F-statistic: 56.97 on 4 and 4954 DF, p-value: < 2.2e-16
freq_married <-sex_data %>%
lm(sex_freq_num~married, .)
summary(freq_married)
##
## Call:
## lm(formula = sex_freq_num ~ married, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.6876 -0.6876 0.3124 0.9931 1.9931
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.68763 0.03879 95.06 <2e-16 ***
## marriedTRUE -0.68076 0.04620 -14.73 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.484 on 4957 degrees of freedom
## (2599 observations deleted due to missingness)
## Multiple R-squared: 0.04196, Adjusted R-squared: 0.04176
## F-statistic: 217.1 on 1 and 4957 DF, p-value: < 2.2e-16
ggplot(data = clean_sd, aes(x = age, y = totlike,color = status)) + geom_point(alpha = 0.2) + geom_smooth(se = F) +
jrothsch_theme + labs(title = "Liking Sex by Age - ", x = "Age", y = "Like Score")
ggplot(data = clean_sd, aes(x = age, y = totlike,color = married)) + geom_point(alpha = 0.2) + geom_smooth(se = F) + jrothsch_theme + labs(title = "Liking Sex by Age - Marriage Binary", x = "Age", y = "Like Score", color = "") + scale_color_discrete(labels = c("Unmarried", "Married"))
ggplot(data = sex_data, aes(x = age, y = want,color = status)) + geom_point(alpha = 0.2) + geom_smooth(se = F) +
jrothsch_theme + labs(title = "Wanting Sex by Age - ", x = "Age", y = "Want Score")
ggplot(data = sex_data, aes(x = age, y = want,color = married)) + geom_point(alpha = 0.2) + geom_smooth(se = F) +
jrothsch_theme + labs(title = "Wanting Sex by Age - ", x = "Age", y = "Want Score", color = "") + scale_color_discrete(labels = c("Unmarried", "Married"))
ggplot(data = sex_data, aes(x = age, y = sex_freq_num,color = status)) + geom_smooth(se = F) +
jrothsch_theme + labs(title = "Sex Frequency by Age - ", x = "Age", y = "Like Score")
ggplot(data = sex_data, aes(x = age, y = sex_freq_num, color = married)) + geom_smooth(se = F) +
jrothsch_theme + labs(title = "Liking Sex by Age - Marriage Binary", x = "Age", y = "Like Score",color = "") + scale_color_discrete(labels = c("Unmarried", "Married"))
want_status_age <-sex_data %>%
lm(want~status+age, .)
summary(want_status_age)
##
## Call:
## lm(formula = want ~ status + age, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -24.454 -6.084 0.047 6.254 25.718
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 31.628969 0.410493 77.051 < 2e-16 ***
## statusCohabiting 1.946992 0.365921 5.321 1.08e-07 ***
## statusDating 4.069449 0.364711 11.158 < 2e-16 ***
## statusSeparated 2.630351 1.243460 2.115 0.034448 *
## statusDivorced 4.279122 1.163207 3.679 0.000237 ***
## age -0.148762 0.007376 -20.169 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.637 on 5155 degrees of freedom
## (2397 observations deleted due to missingness)
## Multiple R-squared: 0.1414, Adjusted R-squared: 0.1405
## F-statistic: 169.7 on 5 and 5155 DF, p-value: < 2.2e-16
want_married_age <-sex_data %>%
lm(want~married+age, .)
summary(want_married_age)
##
## Call:
## lm(formula = want ~ married + age, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -23.4936 -6.0383 0.0784 6.2821 25.7801
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 34.787681 0.351816 98.88 <2e-16 ***
## marriedTRUE -3.054551 0.280635 -10.88 <2e-16 ***
## age -0.150762 0.007326 -20.58 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.654 on 5158 degrees of freedom
## (2397 observations deleted due to missingness)
## Multiple R-squared: 0.1374, Adjusted R-squared: 0.1371
## F-statistic: 410.9 on 2 and 5158 DF, p-value: < 2.2e-16
like_status_age<-sex_data %>%
lm(totlike~status+age, .)
summary(like_status_age)
##
## Call:
## lm(formula = totlike ~ status + age, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -26.8240 -7.0628 0.9145 8.1199 17.6596
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 38.33621 0.47924 79.994 < 2e-16 ***
## statusCohabiting 1.83471 0.42553 4.312 1.65e-05 ***
## statusDating 4.30304 0.42338 10.163 < 2e-16 ***
## statusSeparated 3.36907 1.48830 2.264 0.02364 *
## statusDivorced 3.73857 1.32060 2.831 0.00466 **
## age -0.07224 0.00866 -8.342 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.8 on 4852 degrees of freedom
## (2700 observations deleted due to missingness)
## Multiple R-squared: 0.05578, Adjusted R-squared: 0.0548
## F-statistic: 57.32 on 5 and 4852 DF, p-value: < 2.2e-16
like_married_age <-sex_data %>%
lm(totlike~married+age, .)
summary(like_married_age)
##
## Call:
## lm(formula = totlike ~ married + age, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -27.667 -7.056 1.004 8.105 17.737
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 41.580172 0.411301 101.094 <2e-16 ***
## marriedTRUE -3.116345 0.326254 -9.552 <2e-16 ***
## age -0.074705 0.008602 -8.685 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.82 on 4855 degrees of freedom
## (2700 observations deleted due to missingness)
## Multiple R-squared: 0.05135, Adjusted R-squared: 0.05096
## F-statistic: 131.4 on 2 and 4855 DF, p-value: < 2.2e-16
freq_status_age<-sex_data %>%
lm(sex_freq_num~status+age, .)
summary(freq_status_age)
##
## Call:
## lm(formula = sex_freq_num ~ status + age, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.4228 -0.7662 0.2673 1.0107 3.2616
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.772897 0.067771 70.427 <2e-16 ***
## statusCohabiting 0.287463 0.060401 4.759 2e-06 ***
## statusDating 0.139658 0.060723 2.300 0.0215 *
## statusSeparated -0.209088 0.204884 -1.021 0.3075
## statusDivorced 0.527640 0.189166 2.789 0.0053 **
## age -0.033555 0.001209 -27.755 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.379 on 4953 degrees of freedom
## (2599 observations deleted due to missingness)
## Multiple R-squared: 0.1727, Adjusted R-squared: 0.1718
## F-statistic: 206.7 on 5 and 4953 DF, p-value: < 2.2e-16
freq_married_age <-sex_data %>%
lm(sex_freq_num~married+age, .)
summary(freq_married_age)
##
## Call:
## lm(formula = sex_freq_num ~ married + age, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.3729 -0.7616 0.2580 1.0069 3.3232
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.972089 0.058693 84.714 < 2e-16 ***
## marriedTRUE -0.213375 0.046169 -4.622 3.91e-06 ***
## age -0.033285 0.001199 -27.753 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.381 on 4956 degrees of freedom
## (2599 observations deleted due to missingness)
## Multiple R-squared: 0.1708, Adjusted R-squared: 0.1705
## F-statistic: 510.5 on 2 and 4956 DF, p-value: < 2.2e-16
want_married_age_i <-sex_data %>%
lm(want~married+age*married, .)
summary(want_married_age_i)
##
## Call:
## lm(formula = want ~ married + age * married, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -22.6176 -6.0654 0.0477 6.3018 26.7228
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 32.20767 0.54179 59.447 < 2e-16 ***
## marriedTRUE 1.11344 0.72359 1.539 0.124
## age -0.08260 0.01313 -6.291 3.41e-10 ***
## marriedTRUE:age -0.09865 0.01580 -6.245 4.57e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.622 on 5157 degrees of freedom
## (2397 observations deleted due to missingness)
## Multiple R-squared: 0.1439, Adjusted R-squared: 0.1434
## F-statistic: 288.9 on 3 and 5157 DF, p-value: < 2.2e-16
like_married_age_i <-sex_data %>%
lm(totlike~married+age*married, .)
summary(like_married_age_i)
##
## Call:
## lm(formula = totlike ~ married + age * married, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -28.3797 -7.1191 0.9495 8.1255 18.4797
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 39.62741 0.63077 62.824 < 2e-16 ***
## marriedTRUE 0.06684 0.84573 0.079 0.937
## age -0.02311 0.01529 -1.511 0.131
## marriedTRUE:age -0.07537 0.01848 -4.078 4.61e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.804 on 4854 degrees of freedom
## (2700 observations deleted due to missingness)
## Multiple R-squared: 0.05459, Adjusted R-squared: 0.05401
## F-statistic: 93.43 on 3 and 4854 DF, p-value: < 2.2e-16
freq_married_age_i <-sex_data %>%
lm(sex_freq_num~married+age*married, .)
summary(freq_married_age_i)
##
## Call:
## lm(formula = sex_freq_num ~ married + age * married, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.3082 -0.8145 0.2267 1.0435 3.2425
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.277600 0.090494 47.270 < 2e-16 ***
## marriedTRUE 0.894488 0.119728 7.471 9.35e-14 ***
## age -0.015289 0.002154 -7.096 1.46e-12 ***
## marriedTRUE:age -0.025851 0.002582 -10.012 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.367 on 4955 degrees of freedom
## (2599 observations deleted due to missingness)
## Multiple R-squared: 0.1873, Adjusted R-squared: 0.1868
## F-statistic: 380.6 on 3 and 4955 DF, p-value: < 2.2e-16
Looking at smaller datasets, broken up by age range
Creating datasets
young <- clean_sd[clean_sd$age < 40,]
middle <- clean_sd[clean_sd$age >39 & clean_sd$age < 60,]
old <- clean_sd[clean_sd$age >59,]
Summary datasets
####Young
summary_cat_young <- young %>%
group_by(status) %>%
summarise(wantavg = mean(want), sdwant = sd(want),
like = mean(totlike), sdlike = sd(totlike),
freq = mean(sex_freq_num), sdfreq= sd(sex_freq_num),
len = length(totlike))
summary_bin_young <- young %>%
group_by(married) %>%
summarise(wantavg = mean(want), sdwant = sd(want),
like = mean(totlike), sdlike = sd(totlike),
freq = mean(sex_freq_num), sdfreq = sd(sex_freq_num),
len = length(totlike))
###Old
summary_cat_old <- old %>%
group_by(status) %>%
summarise(wantavg = mean(want), sdwant = sd(want),
like = mean(totlike), sdlike = sd(totlike),
freq = mean(sex_freq_num), sdfreq= sd(sex_freq_num),
len = length(totlike))
summary_bin_old <- old %>%
group_by(married) %>%
summarise(wantavg = mean(want), sdwant = sd(want),
like = mean(totlike), sdlike = sd(totlike),
freq = mean(sex_freq_num), sdfreq = sd(sex_freq_num),
len = length(totlike))
####Middle
summary_cat_middle <- middle %>%
group_by(status) %>%
summarise(wantavg = mean(want), sdwant = sd(want),
like = mean(totlike), sdlike = sd(totlike),
freq = mean(sex_freq_num), sdfreq= sd(sex_freq_num),
len = length(totlike))
summary_bin_middle <- middle %>%
group_by(married) %>%
summarise(wantavg = mean(want), sdwant = sd(want),
like = mean(totlike), sdlike = sd(totlike),
freq = mean(sex_freq_num), sdfreq = sd(sex_freq_num),
len = length(totlike))
##young
summary_cat_young <- summary_cat_young %>%
mutate(sewant = sdwant/sqrt(len),
selike = sdlike/sqrt(len),
sefreq = sdfreq/sqrt(len))
summary_bin_young <- summary_bin_young %>%
mutate(sewant = sdwant/sqrt(len),
selike = sdlike/sqrt(len),
sefreq = sdfreq/sqrt(len))
##old
summary_cat_old <- summary_cat_old %>%
mutate(sewant = sdwant/sqrt(len),
selike = sdlike/sqrt(len),
sefreq = sdfreq/sqrt(len))
summary_bin_old <- summary_bin_old%>%
mutate(sewant = sdwant/sqrt(len),
selike = sdlike/sqrt(len),
sefreq = sdfreq/sqrt(len))
##Middle
summary_cat_middle <- summary_cat_middle %>%
mutate(sewant = sdwant/sqrt(len),
selike = sdlike/sqrt(len),
sefreq = sdfreq/sqrt(len))
summary_bin_middle <- summary_bin_middle %>%
mutate(sewant = sdwant/sqrt(len),
selike = sdlike/sqrt(len),
sefreq = sdfreq/sqrt(len))
like_young <- ggplot(data = summary_bin_young, aes(x = married, y = like)) +
geom_bar(stat = 'identity',position = "dodge", fill = "black", color = "black") +
geom_errorbar(aes(ymin= like - selike*2, ymax = like + selike*2 ), color = 'red', width = .25) +
geom_text(aes(label = round(like, digits = 2)), nudge_y = -4, color = "white") + jrothsch_theme +
labs(title = "Liking", x = "", y = "Average Like Score") + scale_x_discrete(labels = c("Unmarried", "Married"))
want_young <- ggplot(data = summary_bin_young, aes(x = married, y = wantavg)) +
geom_bar(stat = 'identity',position = "dodge", fill = "black", color = "black") +
geom_errorbar(aes(ymin= wantavg - sewant*2, ymax = wantavg + sewant*2 ), color = 'red', width = .25) +
geom_text(aes(label = round(wantavg, digits = 2)), nudge_y = - 3, color = "white") + jrothsch_theme +
labs(title = "Wanting", x = "", y = "Average Want Score") + scale_x_discrete(labels = c("Unmarried", "Married"))
freq_young <- ggplot(data = summary_bin_young, aes(x = married, y = freq)) +
geom_bar(stat = 'identity',position = "dodge", fill = "black", color = "black") +
geom_errorbar(aes(ymin= freq - sefreq*2, ymax = freq + sefreq*2 ), color = 'red', width = .25) +
geom_text(aes(label = round(freq, digits = 2)), nudge_y = -.3, color = "white") + jrothsch_theme +
labs(title = "Frequency", x = "", y = "Average Frequency Score") + scale_x_discrete(labels = c("Unmarried", "Married"))
grid.arrange(want_young, like_young, freq_young, ncol = 3)
like_middle <- ggplot(data = summary_bin_middle, aes(x = married, y = like)) +
geom_bar(stat = 'identity',position = "dodge", fill = "black", color = "black") +
geom_errorbar(aes(ymin= like - selike*2, ymax = like + selike*2 ), color = 'red', width = .25) +
geom_text(aes(label = round(like, digits = 2)), nudge_y = -4, color = "white") + jrothsch_theme +
labs(title = "Liking", x = "", y = "Average Like Score") + scale_x_discrete(labels = c("Unmarried", "Married"))
want_middle <- ggplot(data = summary_bin_middle, aes(x = married, y = wantavg)) +
geom_bar(stat = 'identity',position = "dodge", fill = "black", color = "black") +
geom_errorbar(aes(ymin= wantavg - sewant*2, ymax = wantavg + sewant*2 ), color = 'red', width = .25) +
geom_text(aes(label = round(wantavg, digits = 2)), nudge_y = - 3, color = "white") + jrothsch_theme +
labs(title = "Wanting", x = "", y = "Average Want Score") + scale_x_discrete(labels = c("Unmarried", "Married"))
freq_middle <- ggplot(data = summary_bin_middle, aes(x = married, y = freq)) +
geom_bar(stat = 'identity',position = "dodge", fill = "black", color = "black") +
geom_errorbar(aes(ymin= freq - sefreq*2, ymax = freq + sefreq*2 ), color = 'red', width = .25) +
geom_text(aes(label = round(freq, digits = 2)), nudge_y = -.3, color = "white") + jrothsch_theme +
labs(title = "Frequency", x = "", y = "Average Frequency Score") + scale_x_discrete(labels = c("Unmarried", "Married"))
grid.arrange(want_middle, like_middle, freq_middle, ncol = 3)
like_old <- ggplot(data = summary_bin_old, aes(x = married, y = like)) +
geom_bar(stat = 'identity',position = "dodge", fill = "black", color = "black") +
geom_errorbar(aes(ymin= like - selike*2, ymax = like + selike*2 ), color = 'red', width = .25) +
geom_text(aes(label = round(like, digits = 2)), nudge_y = -4, color = "white") + jrothsch_theme +
labs(title = "Like+", x = "", y = "Average Like Score") + scale_x_discrete(labels = c("Unmarried", "Married"))
want_old <- ggplot(data = summary_bin_old, aes(x = married, y = wantavg)) +
geom_bar(stat = 'identity',position = "dodge", fill = "black", color = "black") +
geom_errorbar(aes(ymin= wantavg - sewant*2, ymax = wantavg + sewant*2 ), color = 'red', width = .25) +
geom_text(aes(label = round(wantavg, digits = 2)), nudge_y = - 3, color = "white") + jrothsch_theme +
labs(title = "Want", x = "", y = "Average Want Score") + scale_x_discrete(labels = c("Unmarried", "Married"))
freq_old <- ggplot(data = summary_bin_old, aes(x = married, y = freq)) +
geom_bar(stat = 'identity',position = "dodge", fill = "black", color = "black") +
geom_errorbar(aes(ymin= freq - sefreq*2, ymax = freq + sefreq*2 ), color = 'red', width = .25) +
geom_text(aes(label = round(freq, digits = 2)), nudge_y = -.3, color = "white") + jrothsch_theme +
labs(title = "Frequency", x = "", y = "Average Frequency Score") + scale_x_discrete(labels = c("Unmarried", "Married"))
grid.arrange(want_old, like_old, freq_old, ncol = 3)
ggplot(data = clean_sd, aes(x = age, y = totlike,color = MALE)) + geom_point(alpha = 0.2) + geom_smooth(se = F) +
jrothsch_theme + labs(title = "Liking Sex by Age - ", x = "Age", y = "Like Score")
ggplot(data = clean_sd, aes(x = age, y = want,color = MALE)) + geom_point(alpha = 0.2) + geom_smooth(se = F) +
jrothsch_theme + labs(title = "Liking Sex by Age - ", x = "Age", y = "Like Score")
ggplot(data = clean_sd, aes(x = age, y = sex_freq_num,color = MALE)) + geom_smooth(se = F) +
jrothsch_theme + labs(title = "Liking Sex by Age", x = "Age", y = "Like Score")
want_gender<-sex_data %>%
lm(want~MALE, .)
summary(want_gender)
##
## Call:
## lm(formula = want ~ MALE, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -19.3921 -6.1921 0.1079 6.4398 21.0148
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 23.9852 0.1837 130.60 <2e-16 ***
## MALEMale 2.9319 0.2563 11.44 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.201 on 5159 degrees of freedom
## (2397 observations deleted due to missingness)
## Multiple R-squared: 0.02475, Adjusted R-squared: 0.02456
## F-statistic: 130.9 on 1 and 5159 DF, p-value: < 2.2e-16
like_gender<-sex_data %>%
lm(want~MALE, .)
summary(like_gender)
##
## Call:
## lm(formula = want ~ MALE, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -19.3921 -6.1921 0.1079 6.4398 21.0148
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 23.9852 0.1837 130.60 <2e-16 ***
## MALEMale 2.9319 0.2563 11.44 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.201 on 5159 degrees of freedom
## (2397 observations deleted due to missingness)
## Multiple R-squared: 0.02475, Adjusted R-squared: 0.02456
## F-statistic: 130.9 on 1 and 5159 DF, p-value: < 2.2e-16
freq_gender<-sex_data %>%
lm(sex_freq_num~MALE, .)
summary(freq_gender)
##
## Call:
## lm(formula = sex_freq_num ~ MALE, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.2317 -0.2317 0.7683 0.8147 1.8147
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.23173 0.03097 104.339 <2e-16 ***
## MALEMale -0.04648 0.04308 -1.079 0.281
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.516 on 4957 degrees of freedom
## (2599 observations deleted due to missingness)
## Multiple R-squared: 0.0002348, Adjusted R-squared: 3.31e-05
## F-statistic: 1.164 on 1 and 4957 DF, p-value: 0.2807
want_gender_age_married<-sex_data %>%
lm(want~MALE + age + married, .)
summary(want_gender_age_married)
##
## Call:
## lm(formula = want ~ MALE + age + married, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -26.1688 -5.9247 -0.1523 5.8069 27.2076
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 33.771218 0.345020 97.88 <2e-16 ***
## MALEMale 4.448999 0.239625 18.57 <2e-16 ***
## age -0.181058 0.007279 -24.87 <2e-16 ***
## marriedTRUE -2.800206 0.272072 -10.29 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.379 on 5157 degrees of freedom
## (2397 observations deleted due to missingness)
## Multiple R-squared: 0.1915, Adjusted R-squared: 0.191
## F-statistic: 407.1 on 3 and 5157 DF, p-value: < 2.2e-16
like_gender_age_married<-sex_data %>%
lm(totlike~MALE + age + married, .)
summary(like_gender_age_married)
##
## Call:
## lm(formula = totlike ~ MALE + age + married, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -28.2996 -7.0924 0.9234 7.9539 19.1301
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 41.145861 0.414942 99.161 < 2e-16 ***
## MALEMale 1.878344 0.288213 6.517 7.89e-11 ***
## age -0.087492 0.008787 -9.957 < 2e-16 ***
## marriedTRUE -3.014147 0.325247 -9.267 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.778 on 4854 degrees of freedom
## (2700 observations deleted due to missingness)
## Multiple R-squared: 0.05958, Adjusted R-squared: 0.059
## F-statistic: 102.5 on 3 and 4854 DF, p-value: < 2.2e-16
want_gender_age_married_i<-sex_data %>%
lm(want~MALE + age + married + age*married, .)
summary(want_gender_age_married_i)
##
## Call:
## lm(formula = want ~ MALE + age + married + age * married, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -25.3818 -5.9095 -0.1489 5.7982 28.1441
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 30.93573 0.52836 58.551 < 2e-16 ***
## MALEMale 4.50329 0.23862 18.872 < 2e-16 ***
## age -0.10685 0.01276 -8.370 < 2e-16 ***
## marriedTRUE 1.76359 0.70074 2.517 0.0119 *
## age:marriedTRUE -0.10794 0.01529 -7.061 1.87e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.34 on 5156 degrees of freedom
## (2397 observations deleted due to missingness)
## Multiple R-squared: 0.1992, Adjusted R-squared: 0.1986
## F-statistic: 320.7 on 4 and 5156 DF, p-value: < 2.2e-16
like_gender_age_married_i<-sex_data %>%
lm(totlike~MALE + age + married + age*married, .)
summary(like_gender_age_married_i)
##
## Call:
## lm(formula = totlike ~ MALE + age + married + age * married,
## data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -29.1982 -7.1395 0.9205 7.9130 19.9478
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 39.07167 0.63345 61.681 < 2e-16 ***
## MALEMale 1.92191 0.28786 6.676 2.72e-11 ***
## age -0.03325 0.01530 -2.173 0.0298 *
## marriedTRUE 0.35293 0.84305 0.419 0.6755
## age:marriedTRUE -0.07967 0.01841 -4.328 1.54e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.761 on 4853 degrees of freedom
## (2700 observations deleted due to missingness)
## Multiple R-squared: 0.0632, Adjusted R-squared: 0.06242
## F-statistic: 81.85 on 4 and 4853 DF, p-value: < 2.2e-16
like_gender_age_married_i<-sex_data %>%
lm(totlike~MALE + age + MALE*age + married + age*married, .)
summary(like_gender_age_married_i)
##
## Call:
## lm(formula = totlike ~ MALE + age + MALE * age + married + age *
## married, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -29.3381 -7.0618 0.9201 7.9575 21.2144
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 40.35223 0.72034 56.018 < 2e-16 ***
## MALEMale -0.93732 0.82119 -1.141 0.253756
## age -0.06208 0.01713 -3.623 0.000294 ***
## marriedTRUE 0.45236 0.84236 0.537 0.591279
## MALEMale:age 0.06066 0.01632 3.717 0.000204 ***
## age:marriedTRUE -0.08272 0.01840 -4.495 7.12e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.748 on 4852 degrees of freedom
## (2700 observations deleted due to missingness)
## Multiple R-squared: 0.06586, Adjusted R-squared: 0.06489
## F-statistic: 68.41 on 5 and 4852 DF, p-value: < 2.2e-16
want_gender_age_married_i<-sex_data %>%
lm(want~MALE + age + MALE*age + married + age*married, .)
summary(want_gender_age_married_i)
##
## Call:
## lm(formula = want ~ MALE + age + MALE * age + married + age *
## married, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -24.9136 -5.9330 -0.2033 5.8371 28.7121
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 31.58369 0.59932 52.699 < 2e-16 ***
## MALEMale 3.04147 0.68217 4.459 8.43e-06 ***
## age -0.12134 0.01425 -8.517 < 2e-16 ***
## marriedTRUE 1.81418 0.70080 2.589 0.00966 **
## MALEMale:age 0.03078 0.01346 2.287 0.02222 *
## age:marriedTRUE -0.10949 0.01530 -7.158 9.32e-13 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.337 on 5155 degrees of freedom
## (2397 observations deleted due to missingness)
## Multiple R-squared: 0.2, Adjusted R-squared: 0.1992
## F-statistic: 257.8 on 5 and 5155 DF, p-value: < 2.2e-16
Wanting and liking
Creating Variables
library(ppls)
clean_sd <- clean_sd %>% mutate(want_norm = normalize.vector(want), like_norm = normalize.vector(totlike))
clean_sd <- clean_sd %>% mutate(dif_norm = want_norm - like_norm, absdif = abs(want_norm - like_norm))
ggplot(data = clean_sd, aes(y = dif_norm, x = married)) +
geom_boxplot() + jrothsch_theme +
labs(title = "Difference Between Liking And Wanting Sex", x = "", y = "Normalized Want - Normalized Like") + scale_x_discrete(labels = c("Unmarried", "Married"))
ggplot(data = clean_sd, aes(x = dif_norm)) + geom_density(aes(fill = married), alpha = 0.5) + jrothsch_theme +
labs(title = "Difference Between Liking And Wanting Sex", x = "Normalized Want - Normalized Like", y = "Density", fill = "") + scale_fill_discrete(labels = c("Unmarried", "Married"))
ggplot(data = clean_sd, aes(x = dif_norm)) + geom_density(aes(fill = MALE), alpha = 0.5) + jrothsch_theme +
labs(title = "Difference Between Liking And Wanting Sex", x = "Normalized Want - Normalized Like", y = "Density", fill = "")
ggplot(data = clean_sd, aes(y = dif_norm, x = age, color = married)) +
geom_point(size = .2) + geom_smooth() + jrothsch_theme +
labs(title = "Difference Between Liking And Wanting Sex, By Age", y = "Normalized Want - Normalized Like", x = "Age", color = "") + scale_color_discrete(labels = c("Unmarried", "Married"))
ggplot(data = clean_sd, aes(y = absdif, x = age, color = married)) +
geom_point(size = 1) + geom_smooth() + jrothsch_theme +
labs(title = "Absolute Difference Between Liking And Wanting Sex", x = "Age", y = "Abs(want - like)") + scale_color_discrete(labels = c("Unmarried", "Married"))
ggplot(data = clean_sd, aes(y = dif_norm, x = age, color = MALE)) +
geom_point(size = .2) + geom_smooth() + jrothsch_theme +
labs(title = "Difference Between Liking And Wanting Sex, By Age", y = "Normalized Want - Normalized Like", x = "Age", color = "") + scale_color_discrete(labels = c("Female", "Male"))
resid_age_married_gender <-clean_sd %>%
lm(dif_norm~married+age + MALE, .)
summary(resid_age_married_gender)
##
## Call:
## lm(formula = dif_norm ~ married + age + MALE, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0181799 -0.0028279 0.0000297 0.0028669 0.0228350
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.215e-03 2.350e-04 9.427 <2e-16 ***
## marriedTRUE -3.641e-04 1.849e-04 -1.969 0.0491 *
## age -7.221e-05 4.961e-06 -14.556 <2e-16 ***
## MALEMale 2.093e-03 1.640e-04 12.763 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.004475 on 3203 degrees of freedom
## Multiple R-squared: 0.09936, Adjusted R-squared: 0.09852
## F-statistic: 117.8 on 3 and 3203 DF, p-value: < 2.2e-16
resid_age_married_gender_i <-clean_sd %>%
lm(dif_norm ~married+age + MALE + age*MALE, .)
summary(resid_age_married_gender_i)
##
## Call:
## lm(formula = dif_norm ~ married + age + MALE + age * MALE, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0181548 -0.0028387 0.0000485 0.0028533 0.0228694
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.036e-03 3.152e-04 6.459 1.22e-10 ***
## marriedTRUE -3.650e-04 1.849e-04 -1.974 0.0485 *
## age -6.801e-05 6.983e-06 -9.739 < 2e-16 ***
## MALEMale 2.466e-03 4.664e-04 5.287 1.33e-07 ***
## age:MALEMale -7.921e-06 9.272e-06 -0.854 0.3930
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.004476 on 3202 degrees of freedom
## Multiple R-squared: 0.09957, Adjusted R-squared: 0.09844
## F-statistic: 88.52 on 4 and 3202 DF, p-value: < 2.2e-16
ggplot(data = clean_sd, aes(x = duration, y = want)) + geom_boxplot() + jrothsch_theme + labs(title = "Wanting By Duration", y = "Want Score", x = "Duration Category")
##Like
ggplot(data = clean_sd, aes(x = duration, y = totlike)) + geom_boxplot() + jrothsch_theme + labs(title = "Liking By Duration", y = "Like Score", x = "Duration Category")
ggplot(data = clean_sd, aes(x = duration, y = sex_freq_num)) + geom_boxplot() + jrothsch_theme +labs(title = "Frequency By Duration", y = "Frequency Score", x = "Duration Category")
dur <- clean_sd %>%
lm(want ~Years_PrimaryPartner, .)
summary(dur)
##
## Call:
## lm(formula = want ~ Years_PrimaryPartner, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -20.5019 -5.8009 -0.0845 5.9832 27.1161
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 28.778214 0.223473 128.78 <2e-16 ***
## Years_PrimaryPartner -0.187833 0.009112 -20.61 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.432 on 3205 degrees of freedom
## Multiple R-squared: 0.1171, Adjusted R-squared: 0.1168
## F-statistic: 424.9 on 1 and 3205 DF, p-value: < 2.2e-16
age <- clean_sd %>%
lm(want ~age, .)
summary(age)
##
## Call:
## lm(formula = want ~ age, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -20.9099 -5.9784 0.0429 6.1219 27.7206
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 32.834287 0.434092 75.64 <2e-16 ***
## age -0.157120 0.008538 -18.40 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.534 on 3205 degrees of freedom
## Multiple R-squared: 0.09556, Adjusted R-squared: 0.09528
## F-statistic: 338.6 on 1 and 3205 DF, p-value: < 2.2e-16
age_or_dur <- clean_sd %>%
lm(want ~age + Years_PrimaryPartner, .)
summary(age_or_dur)
##
## Call:
## lm(formula = want ~ age + Years_PrimaryPartner, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -20.689 -5.858 -0.025 6.080 27.349
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 30.87339 0.46832 65.924 < 2e-16 ***
## age -0.06328 0.01244 -5.085 3.89e-07 ***
## Years_PrimaryPartner -0.13742 0.01344 -10.224 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.4 on 3204 degrees of freedom
## Multiple R-squared: 0.1241, Adjusted R-squared: 0.1236
## F-statistic: 227 on 2 and 3204 DF, p-value: < 2.2e-16
age_or_dur_i <- clean_sd %>%
lm(want ~age + Years_PrimaryPartner + age*Years_PrimaryPartner, .)
summary(age_or_dur_i)
##
## Call:
## lm(formula = want ~ age + Years_PrimaryPartner + age * Years_PrimaryPartner,
## data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -20.7054 -5.8444 -0.0024 6.0462 26.5202
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 31.278610 0.565854 55.277 < 2e-16 ***
## age -0.070066 0.013533 -5.178 2.39e-07 ***
## Years_PrimaryPartner -0.195685 0.047609 -4.110 4.05e-05 ***
## age:Years_PrimaryPartner 0.000907 0.000711 1.276 0.202
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.399 on 3203 degrees of freedom
## Multiple R-squared: 0.1246, Adjusted R-squared: 0.1238
## F-statistic: 151.9 on 3 and 3203 DF, p-value: < 2.2e-16
ggplot(data = clean_sd, aes(x = Years_PrimaryPartner, y = want, color = married)) + geom_point() + geom_smooth(se = F) + jrothsch_theme + labs(title = "Wanting By Duration, Marriage", y = "Wanting", x = "Duration", color = "") + scale_color_discrete(labels = c("Unmarried", "Married"))
ggplot(data = clean_sd, aes(x = Years_PrimaryPartner, y = totlike, color = married)) + geom_point() + geom_smooth(se = F) + jrothsch_theme + labs(title = "Liking By Duration, Marriage", y = "Liking", x = "Duration", color = "") + scale_color_discrete(labels = c("Unmarried", "Married"))
ggplot(data = clean_sd, aes(x = Years_PrimaryPartner, y = sex_freq_num, color = married)) + geom_smooth(se = F) + jrothsch_theme + labs(title = "Frequency By Duration, Marriage", y = "Frequency", x = "Duration", color = "") + scale_color_discrete(labels = c("Unmarried", "Married"))
want_all <-clean_sd %>%
lm(want~married + MALE + Years_PrimaryPartner + age, .)
summary(want_all)
##
## Call:
## lm(formula = want ~ married + MALE + Years_PrimaryPartner + age,
## data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -19.5605 -5.6059 -0.0796 5.7131 25.6990
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 30.99116 0.48311 64.149 < 2e-16 ***
## marriedTRUE -1.64457 0.36083 -4.558 5.36e-06 ***
## MALEMale 4.54083 0.29691 15.294 < 2e-16 ***
## Years_PrimaryPartner -0.09648 0.01402 -6.880 7.16e-12 ***
## age -0.10832 0.01231 -8.796 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.083 on 3202 degrees of freedom
## Multiple R-squared: 0.1894, Adjusted R-squared: 0.1884
## F-statistic: 187 on 4 and 3202 DF, p-value: < 2.2e-16
totlike_all <-clean_sd %>%
lm(totlike~married + MALE + Years_PrimaryPartner + age, .)
summary(totlike_all)
##
## Call:
## lm(formula = totlike ~ married + MALE + Years_PrimaryPartner +
## age, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -27.4494 -6.9765 0.7956 7.8375 19.3927
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 38.79345 0.57608 67.341 < 2e-16 ***
## marriedTRUE -2.03371 0.43027 -4.727 2.38e-06 ***
## MALEMale 1.93866 0.35405 5.476 4.69e-08 ***
## Years_PrimaryPartner -0.07704 0.01672 -4.608 4.23e-06 ***
## age -0.03111 0.01468 -2.118 0.0342 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.639 on 3202 degrees of freedom
## Multiple R-squared: 0.0569, Adjusted R-squared: 0.05572
## F-statistic: 48.29 on 4 and 3202 DF, p-value: < 2.2e-16
freq_all <-clean_sd %>%
lm(sex_freq_num~married + MALE + Years_PrimaryPartner + age, .)
summary(freq_all)
##
## Call:
## lm(formula = sex_freq_num ~ married + MALE + Years_PrimaryPartner +
## age, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.3769 -0.7586 0.2254 0.9590 3.3028
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.636485 0.080094 57.888 < 2e-16 ***
## marriedTRUE -0.035879 0.059821 -0.600 0.549
## MALEMale 0.203557 0.049224 4.135 3.64e-05 ***
## Years_PrimaryPartner -0.014256 0.002325 -6.132 9.73e-10 ***
## age -0.024938 0.002042 -12.215 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.34 on 3202 degrees of freedom
## Multiple R-squared: 0.1786, Adjusted R-squared: 0.1776
## F-statistic: 174.1 on 4 and 3202 DF, p-value: < 2.2e-16
dif_all <-clean_sd %>%
lm(dif_norm~married + MALE + Years_PrimaryPartner + age, .)
summary(dif_all)
##
## Call:
## lm(formula = dif_norm ~ married + MALE + Years_PrimaryPartner +
## age, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0181684 -0.0028569 0.0000035 0.0028968 0.0223966
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.779e-03 2.670e-04 6.663 3.14e-11 ***
## marriedTRUE -1.063e-04 1.994e-04 -0.533 0.593950
## MALEMale 2.054e-03 1.641e-04 12.517 < 2e-16 ***
## Years_PrimaryPartner -2.648e-05 7.751e-06 -3.416 0.000643 ***
## age -5.625e-05 6.807e-06 -8.264 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.004468 on 3202 degrees of freedom
## Multiple R-squared: 0.1026, Adjusted R-squared: 0.1015
## F-statistic: 91.56 on 4 and 3202 DF, p-value: < 2.2e-16
want_all_i <-clean_sd %>%
lm(want~married + MALE + Years_PrimaryPartner + age + age*married + MALE*married + Years_PrimaryPartner*married, .)
summary(want_all_i)
##
## Call:
## lm(formula = want ~ married + MALE + Years_PrimaryPartner + age +
## age * married + MALE * married + Years_PrimaryPartner * married,
## data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -20.6207 -5.5852 -0.0394 5.6462 25.5692
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 29.83591 0.65745 45.381 < 2e-16 ***
## marriedTRUE 0.84996 0.90806 0.936 0.349336
## MALEMale 3.32272 0.53510 6.210 6.00e-10 ***
## Years_PrimaryPartner -0.20879 0.03929 -5.314 1.14e-07 ***
## age -0.04498 0.01792 -2.510 0.012112 *
## marriedTRUE:age -0.11532 0.02468 -4.672 3.10e-06 ***
## marriedTRUE:MALEMale 1.83184 0.64241 2.852 0.004379 **
## marriedTRUE:Years_PrimaryPartner 0.15528 0.04271 3.636 0.000282 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.052 on 3199 degrees of freedom
## Multiple R-squared: 0.1964, Adjusted R-squared: 0.1946
## F-statistic: 111.7 on 7 and 3199 DF, p-value: < 2.2e-16
totlike_all <-clean_sd %>%
lm(totlike~married + MALE + Years_PrimaryPartner + age + age*married + MALE*married + Years_PrimaryPartner*married, .)
summary(totlike_all)
##
## Call:
## lm(formula = totlike ~ married + MALE + Years_PrimaryPartner +
## age + age * married + MALE * married + Years_PrimaryPartner *
## married, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -26.6162 -6.8709 0.7528 7.7446 22.5908
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 37.98001 0.78425 48.428 < 2e-16 ***
## marriedTRUE -0.19313 1.08320 -0.178 0.858505
## MALEMale 1.22444 0.63830 1.918 0.055166 .
## Years_PrimaryPartner -0.27396 0.04687 -5.846 5.56e-09 ***
## age 0.02927 0.02138 1.369 0.170947
## marriedTRUE:age -0.10541 0.02944 -3.580 0.000349 ***
## marriedTRUE:MALEMale 1.09512 0.76631 1.429 0.153077
## marriedTRUE:Years_PrimaryPartner 0.24323 0.05095 4.774 1.89e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.605 on 3199 degrees of freedom
## Multiple R-squared: 0.06432, Adjusted R-squared: 0.06227
## F-statistic: 31.41 on 7 and 3199 DF, p-value: < 2.2e-16
freq_all <-clean_sd %>%
lm(sex_freq_num~married + MALE + Years_PrimaryPartner + age + age*married + MALE*married + Years_PrimaryPartner*married, .)
summary(freq_all)
##
## Call:
## lm(formula = sex_freq_num ~ married + MALE + Years_PrimaryPartner +
## age + age * married + MALE * married + Years_PrimaryPartner *
## married, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.2154 -0.7638 0.1965 0.9908 3.2929
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.160768 0.108588 38.317 < 2e-16 ***
## marriedTRUE 0.882256 0.149981 5.882 4.46e-09 ***
## MALEMale 0.195467 0.088380 2.212 0.02706 *
## Years_PrimaryPartner -0.031250 0.006489 -4.816 1.53e-06 ***
## age -0.009765 0.002960 -3.299 0.00098 ***
## marriedTRUE:age -0.028904 0.004077 -7.090 1.64e-12 ***
## marriedTRUE:MALEMale 0.034916 0.106104 0.329 0.74212
## marriedTRUE:Years_PrimaryPartner 0.027738 0.007054 3.932 8.60e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.33 on 3199 degrees of freedom
## Multiple R-squared: 0.1918, Adjusted R-squared: 0.19
## F-statistic: 108.4 on 7 and 3199 DF, p-value: < 2.2e-16
dif_all <-clean_sd %>%
lm(dif_norm~married + MALE + Years_PrimaryPartner + age + age*married + MALE*married + Years_PrimaryPartner*married, .)
summary(dif_all)
##
## Call:
## lm(formula = dif_norm ~ married + MALE + Years_PrimaryPartner +
## age + age * married + MALE * married + Years_PrimaryPartner *
## married, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0181872 -0.0028868 0.0000259 0.0028753 0.0224833
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.410e-03 3.645e-04 3.869 0.000112
## marriedTRUE 6.508e-04 5.034e-04 1.293 0.196219
## MALEMale 1.596e-03 2.967e-04 5.380 7.97e-08
## Years_PrimaryPartner -5.953e-06 2.178e-05 -0.273 0.784624
## age -4.357e-05 9.935e-06 -4.385 1.20e-05
## marriedTRUE:age -2.527e-05 1.368e-05 -1.847 0.064847
## marriedTRUE:MALEMale 6.788e-04 3.561e-04 1.906 0.056747
## marriedTRUE:Years_PrimaryPartner -1.448e-05 2.368e-05 -0.612 0.540841
##
## (Intercept) ***
## marriedTRUE
## MALEMale ***
## Years_PrimaryPartner
## age ***
## marriedTRUE:age .
## marriedTRUE:MALEMale .
## marriedTRUE:Years_PrimaryPartner
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.004464 on 3199 degrees of freedom
## Multiple R-squared: 0.105, Adjusted R-squared: 0.1031
## F-statistic: 53.64 on 7 and 3199 DF, p-value: < 2.2e-16
Race interactions
Econ interactions
Recency