Divide relationship duration into quartiles
data = data %>%
mutate(relationship_duration_factor_quartiles =
factor(ifelse(relationship_status == "Single",
"Single",
ifelse(relationship_duration <= 12,
"upto12months",
ifelse(relationship_duration <= 28,
"upto28months",
ifelse(relationship_duration <= 52,
"upto52months",
ifelse(relationship_duration > 52,
"morethan52months",
NA))))),
levels = c("Single", "upto12months",
"upto28months", "upto52months",
"morethan52months")))
data %>%
group_by(relationship_duration_factor_quartiles) %>%
summarise(count = n()) %>%
add_column(duration_in_years = c("Single",
"upto1year",
"upto2.3years",
"upto4.3years",
"morethan4.3years")) %>%
select(relationship_duration_factor_quartiles, duration_in_years, count) %>%
kable()
relationship_duration_factor_quartiles | duration_in_years | count |
---|---|---|
Single | Single | 405 |
upto12months | upto1year | 198 |
upto28months | upto2.3years | 198 |
upto52months | upto4.3years | 188 |
morethan52months | morethan4.3years | 190 |
plot = ggplot(data, aes(relationship_duration)) +
geom_histogram(aes(fill = relationship_duration_factor_quartiles), bins = 300) +
labs(x = "Relationship Duration (in months)",
y = "Count") +
scale_x_continuous(breaks = c(c(0:30) * 12),
labels = c(c(0:30) * 12)) +
apatheme +
#theme(legend.position = "bottom") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
scale_fill_manual(name = "Categories\nRelationship\nDuration",
labels = c("0‒12 months",
"13‒28 months",
"29‒52 months",
"> 52 months"),
values = c("#1B9E77", "#7570B3", "#D95F02", "#E7298A"))
jpeg('Relationship Duration.jpg',
width = 700, height = 500, quality = 100)
plot
dev.off()
## png
## 2
Divide relationship duration into 8 quantiles
quantiles = quantile(as.numeric(data$relationship_duration),
na.rm = T,
probs = c(0, 0.125, 0.25, 0.375, 0.5,0.625, 0.75, 0.875, 1))
data = data %>%
mutate(relationship_duration_factor_finegrained =
factor(ifelse(relationship_status == "Single",
"Single",
ifelse(relationship_duration <= quantiles[2],
"upto6months",
ifelse(relationship_duration <= quantiles[3],
"upto12months",
ifelse(relationship_duration <= quantiles[4],
"upto20months",
ifelse(relationship_duration <= quantiles[5],
"upto28months",
ifelse(relationship_duration <= quantiles[6],
"upto38months",
ifelse(relationship_duration <= quantiles[7],
"upto52months",
ifelse(relationship_duration <= quantiles[8],
"upto85months",
ifelse(relationship_duration > quantiles[8],
"morethan85months",
NA))))))))),
levels = c("Single", "upto6months", "upto12months",
"upto20months", "upto28months",
"upto38months", "upto52months",
"upto85months", "morethan85months")))
data %>%
group_by(relationship_duration_factor_finegrained) %>%
summarise(count = n()) %>%
add_column(duration_in_years = c("Single",
"upto0.5years",
"upto1year",
"upto1.7year",
"upto2.3years",
"upto3.2years",
"upto4.3years",
"upto7.1years",
"morethan7.1years")) %>%
select(relationship_duration_factor_finegrained, duration_in_years, count) %>%
kable()
relationship_duration_factor_finegrained | duration_in_years | count |
---|---|---|
Single | Single | 405 |
upto6months | upto0.5years | 120 |
upto12months | upto1year | 78 |
upto20months | upto1.7year | 98 |
upto28months | upto2.3years | 100 |
upto38months | upto3.2years | 96 |
upto52months | upto4.3years | 92 |
upto85months | upto7.1years | 93 |
morethan85months | morethan7.1years | 97 |
qplot(data$relationship_duration_factor_finegrained) +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
ggplot(data, aes(relationship_duration)) +
geom_histogram(aes(fill = relationship_duration_factor_finegrained), bins = 200) +
theme(legend.title = element_blank(), legend.position = "bottom")
https://sci-hub.st/10.1016/j.ssresearch.2015.01.009 Effects of relationship duration, cohabitation, and marriage on the frequency of intercourse in couples: Findings from German panel data
Relationship Duration * 0-5 months * 6-11 months * 1-2 years * 2-3 years * 3-4 years * 4-5 years * 5-6 years * 6-8 years * 8-10 years * 10-12 years * 12-14 years * 14-16 years * > 16 years
data = data %>%
mutate(relationship_duration_factor_schroeder =
factor(ifelse(relationship_status == "Single",
"Single",
ifelse(relationship_duration < 6,
"0to5months",
ifelse(relationship_duration < 12,
"6to11months",
ifelse(relationship_duration <= 24,
"1to2years",
ifelse(relationship_duration <= 36,
"2to3years",
ifelse(relationship_duration <= 48,
"3to4years",
ifelse(relationship_duration <= 60,
"4to5years",
ifelse(relationship_duration <= 72,
"5to6years",
ifelse(relationship_duration <= 96,
"6to8years",
ifelse(relationship_duration <= 120,
"8to10years",
ifelse(relationship_duration > 120, "morethan10years",
NA))))))))))),
levels = c("Single", "0to5months", "6to11months",
"1to2years", "2to3years",
"3to4years", "4to5years",
"5to6years", "6to8years",
"8to10years", "morethan10years")))
data %>%
group_by(relationship_duration_factor_schroeder) %>%
summarise(count = n()) %>%
kable()
relationship_duration_factor_schroeder | count |
---|---|
Single | 405 |
0to5months | 92 |
6to11months | 88 |
1to2years | 160 |
2to3years | 125 |
3to4years | 93 |
4to5years | 52 |
5to6years | 44 |
6to8years | 47 |
8to10years | 25 |
morethan10years | 48 |
qplot(data$relationship_duration_factor_schroeder) +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
ggplot(data, aes(relationship_duration)) +
geom_histogram(aes(fill = relationship_duration_factor_schroeder), bins = 200) +
theme(legend.title = element_blank(), legend.position = "bottom")
ggplot(data, aes(relationship_duration_factor_finegrained, diary_libido_mean)) +
geom_jitter() +
stat_summary(fun.data=mean_cl_normal, geom="pointrange", color="red")
ggplot(data, aes(relationship_duration_factor_finegrained, diary_sex_active_sex_mean)) +
geom_jitter() +
stat_summary(fun.data=mean_cl_normal, geom="pointrange", color="red")
ggplot(data, aes(relationship_duration_factor_finegrained, partner_attractiveness_body)) +
geom_jitter() +
stat_summary(fun.data=mean_cl_normal, geom="pointrange", color="red")
ggplot(data, aes(relationship_duration_factor_finegrained, relationship_satisfaction_overall)) +
geom_jitter() +
stat_summary(fun.data=mean_cl_normal, geom="pointrange", color="red")
ggplot(data, aes(relationship_duration_factor_finegrained, satisfaction_sexual_intercourse)) +
geom_jitter() +
stat_summary(fun.data=mean_cl_normal, geom="pointrange", color="red")