#Student: Genesis Santos # # Purpose: # This script organizes the published summary data from the Tuenti article # and creates preliminary visualizations for the Week 13 progress report. # # Important note: # This project is currently using published summary data from the article ###############################################################
# 1. Load packages
if (!require("pacman")) install.packages("pacman")
## Loading required package: pacman
## Warning: package 'pacman' was built under R version 4.5.3
# Loading packages used for data organization and visualization
pacman::p_load(
tidyverse,
ggplot2
)
# 2. Enter reported descriptive data from Table 1
# The following values are reported item means from Apaolaza et al. (2013).
# The items are grouped by construct so they can be summarized and visualized.
tuenti_items <- tibble(
construct = c(
"Socializing", "Socializing", "Socializing", "Socializing",
"Self-esteem", "Self-esteem", "Self-esteem", "Self-esteem",
"Loneliness", "Loneliness", "Loneliness",
"Wellbeing", "Wellbeing", "Wellbeing",
"Tuenti use"
),
item = c(
"Contact with friends",
"Talk to friends living far away",
"Meet and talk to friends from the past",
"Friends show interest",
"Deserve to be appreciated",
"Belief in personal virtues",
"Capable of doing things",
"Positive attitude toward self",
"Feeling lonely",
"Having no company",
"Feeling isolated",
"Life close to personal ideal",
"Conditions of life",
"Life satisfaction",
"Time spent daily using Tuenti"
),
mean = c(
3.35, 3.66, 3.32, 3.24,
3.37, 3.43, 3.44, 3.33,
1.39, 1.32, 1.26,
4.41, 4.89, 5.13,
2.18
),
sd = c(
.76, .71, .67, .89,
.69, .61, .64, .68,
.65, .56, .53,
1.17, 1.11, 1.09,
1.30
)
)
# 3. Summarize item means by construct
construct_summary <- tuenti_items %>%
group_by(construct) %>%
summarise(
number_of_items = n(),
average_item_mean = mean(mean),
average_item_sd = mean(sd),
.groups = "drop"
)
print(construct_summary)
## # A tibble: 5 × 4
## construct number_of_items average_item_mean average_item_sd
## <chr> <int> <dbl> <dbl>
## 1 Loneliness 3 1.32 0.58
## 2 Self-esteem 4 3.39 0.655
## 3 Socializing 4 3.39 0.758
## 4 Tuenti use 1 2.18 1.3
## 5 Wellbeing 3 4.81 1.12
# 4. Create visualization of item means
# This figure shows the reported item means from the article.
ggplot(tuenti_items, aes(x = reorder(item, mean), y = mean)) +
geom_col() +
coord_flip() +
labs(
title = "Reported Item Means from the Tuenti Social Media Study",
subtitle = "Data organized from Apaolaza et al. (2013)",
x = "Survey item",
y = "Reported mean"
)
# 5. Enter reported standardized regression coefficients
path_coefficients <- tibble(
relationship = c(
"Tuenti use → socializing",
"Socializing → self-esteem",
"Socializing → loneliness",
"Self-esteem → wellbeing",
"Loneliness → wellbeing"
),
coefficient = c(.30, .22, -.24, .47, -.27)
)
print(path_coefficients)
## # A tibble: 5 × 2
## relationship coefficient
## <chr> <dbl>
## 1 Tuenti use → socializing 0.3
## 2 Socializing → self-esteem 0.22
## 3 Socializing → loneliness -0.24
## 4 Self-esteem → wellbeing 0.47
## 5 Loneliness → wellbeing -0.27
# 6. Visualize reported path coefficients
ggplot(path_coefficients, aes(x = reorder(relationship, coefficient), y = coefficient)) +
geom_col() +
geom_hline(yintercept = 0) +
coord_flip() +
labs(
title = "Reported Relationships in the Tuenti Social Media Study",
subtitle = "Standardized regression coefficients from Apaolaza et al. (2013)",
x = "Relationship",
y = "Standardized regression coefficient"
)