#file.choose()
survey <- read.csv("/Users/navyaneelamegam/Desktop/Team7_survey_clean.csv",
fileEncoding = "UTF-8",
na.strings = c("", "NA"),
stringsAsFactors = FALSE)
dim(survey) # expect 49 rows, 34 columns
## [1] 49 34
head(survey)
## id timestamp consent enrolled age_eligible ai_use
## 1 1 2026-11-07 13:41:12 Yes, I agree Yes Yes 5
## 2 2 2026-11-07 13:41:15 Yes, I agree Yes Yes 4
## 3 3 2026-11-07 13:41:59 Yes, I agree Yes Yes 4
## 4 4 2026-11-07 13:44:04 Yes, I agree Yes Yes 4
## 5 5 2026-11-07 13:46:13 Yes, I agree Yes Yes 4
## 6 6 2026-11-07 13:55:38 Yes, I agree Yes Yes 4
## ai_disclosure_freq ai_comfort ai_willing ai_holdback ai_judgment
## 1 1 1 1 5 1
## 2 2 3 4 3 1
## 3 1 1 1 5 1
## 4 1 2 1 1 4
## 5 1 1 1 5 1
## 6 3 3 4 2 1
## ai_understanding ai_privacy ai_relief ai_uneasy ai_closure ai_lasting_relief
## 1 1 4 1 4 1 1
## 2 2 5 4 4 4 2
## 3 1 5 1 3 1 2
## 4 1 5 2 4 1 1
## 5 1 5 1 5 1 1
## 6 1 3 3 3 2 1
## human_disclosure_freq human_comfort human_willing human_holdback
## 1 5 5 5 4
## 2 4 4 4 2
## 3 4 5 5 1
## 4 3 3 4 5
## 5 5 5 5 2
## 6 3 4 4 5
## human_judgment human_understanding human_privacy human_relief human_uneasy
## 1 3 4 3 4 2
## 2 2 4 2 5 2
## 3 2 5 2 5 1
## 4 4 3 2 4 3
## 5 2 3 3 5 2
## 6 3 2 3 2 3
## human_closure human_lasting_relief preferred_confidant
## 1 4 4 A close friend
## 2 4 5 A romantic partner
## 3 5 5 A romantic partner
## 4 4 3 A romantic partner
## 5 5 5 Bsf and bf
## 6 2 3 A close friend
## explanation
## 1 Nothing
## 2 Ai is always available, people need time to be available to respond
## 3 Ai is a robot and they are just going to tell me what I want to hear. With a Perón it’s more personal and real.
## 4 A chatbot doesnt have personal human experiences, so it can never actually know what im going through
## 5 Both
## 6 I think its cause AI chatbots are more designed to appease you rather than people who just have their own thought or opinion that influence what they say to you.
## age_group gender year area_study
## 1 22 to 24 Man Senior Communications
## 2 20 to 21 Man Junior Architecture or design
## 3 20 to 21 Woman Junior Arts and sciences
## 4 20 to 21 Man Junior Arts and sciences
## 5 22 to 24 Woman Senior Political Science
## 6 20 to 21 Woman Senior HDFS
str(survey)
## 'data.frame': 49 obs. of 34 variables:
## $ id : int 1 2 3 4 5 6 7 8 9 10 ...
## $ timestamp : chr "2026-11-07 13:41:12" "2026-11-07 13:41:15" "2026-11-07 13:41:59" "2026-11-07 13:44:04" ...
## $ consent : chr "Yes, I agree" "Yes, I agree" "Yes, I agree" "Yes, I agree" ...
## $ enrolled : chr "Yes" "Yes" "Yes" "Yes" ...
## $ age_eligible : chr "Yes" "Yes" "Yes" "Yes" ...
## $ ai_use : int 5 4 4 4 4 4 5 1 5 1 ...
## $ ai_disclosure_freq : int 1 2 1 1 1 3 3 1 2 1 ...
## $ ai_comfort : int 1 3 1 2 1 3 3 1 2 1 ...
## $ ai_willing : int 1 4 1 1 1 4 4 1 2 1 ...
## $ ai_holdback : int 5 3 5 1 5 2 3 3 5 5 ...
## $ ai_judgment : int 1 1 1 4 1 1 1 3 5 1 ...
## $ ai_understanding : int 1 2 1 1 1 1 3 1 1 1 ...
## $ ai_privacy : int 4 5 5 5 5 3 3 5 5 5 ...
## $ ai_relief : int 1 4 1 2 1 3 4 1 1 1 ...
## $ ai_uneasy : int 4 4 3 4 5 3 2 5 3 5 ...
## $ ai_closure : int 1 4 1 1 1 2 4 1 1 1 ...
## $ ai_lasting_relief : int 1 2 2 1 1 1 4 1 1 1 ...
## $ human_disclosure_freq: int 5 4 4 3 5 3 5 4 5 5 ...
## $ human_comfort : int 5 4 5 3 5 4 5 4 5 5 ...
## $ human_willing : int 5 4 5 4 5 4 5 4 5 5 ...
## $ human_holdback : int 4 2 1 5 2 5 3 2 3 1 ...
## $ human_judgment : int 3 2 2 4 2 3 4 1 5 2 ...
## $ human_understanding : int 4 4 5 3 3 2 4 4 5 5 ...
## $ human_privacy : int 3 2 2 2 3 3 2 1 5 1 ...
## $ human_relief : int 4 5 5 4 5 2 4 4 5 5 ...
## $ human_uneasy : int 2 2 1 3 2 3 2 1 3 1 ...
## $ human_closure : int 4 4 5 4 5 2 4 4 5 5 ...
## $ human_lasting_relief : int 4 5 5 3 5 3 5 1 5 5 ...
## $ preferred_confidant : chr "A close friend" "A romantic partner" "A romantic partner" "A romantic partner" ...
## $ explanation : chr "Nothing" "Ai is always available, people need time to be available to respond" "Ai is a robot and they are just going to tell me what I want to hear. With a Perón it’s more personal and real." "A chatbot doesnt have personal human experiences, so it can never actually know what im going through" ...
## $ age_group : chr "22 to 24" "20 to 21" "20 to 21" "20 to 21" ...
## $ gender : chr "Man" "Man" "Woman" "Man" ...
## $ year : chr "Senior" "Junior" "Junior" "Junior" ...
## $ area_study : chr "Communications" "Architecture or design" "Arts and sciences" "Arts and sciences" ...
colSums(is.na(survey))[colSums(is.na(survey)) > 0]
## explanation
## 1
item_names <- c("comfort", "willing", "holdback", "judgment", "understanding",
"privacy", "relief", "uneasy", "closure", "lasting_relief")
rating_cols <- c(paste0("ai_", item_names), paste0("human_", item_names))
sapply(survey[rating_cols], range)
## ai_comfort ai_willing ai_holdback ai_judgment ai_understanding ai_privacy
## [1,] 1 1 1 1 1 1
## [2,] 5 5 5 5 5 5
## ai_relief ai_uneasy ai_closure ai_lasting_relief human_comfort
## [1,] 1 1 1 1 1
## [2,] 4 5 5 5 5
## human_willing human_holdback human_judgment human_understanding
## [1,] 1 1 1 1
## [2,] 5 5 5 5
## human_privacy human_relief human_uneasy human_closure human_lasting_relief
## [1,] 1 1 1 2 1
## [2,] 5 5 5 5 5
survey$gender <- factor(survey$gender)
survey$area_study <- factor(survey$area_study)
survey$preferred_confidant <- factor(survey$preferred_confidant)
survey$age_group <- factor(survey$age_group,
levels = c("18 to 19", "20 to 21", "22 to 24", "25 or older"),
ordered = TRUE)
survey$year <- factor(survey$year,
levels = c("Freshman", "Sophomore", "Junior", "Senior",
"Graduate student", "BA degree", "Prefer not to say"))
table(survey$age_group) # expect 13, 26, 7, 3
##
## 18 to 19 20 to 21 22 to 24 25 or older
## 13 26 7 3
survey$ai_holdback_r <- 6 - survey$ai_holdback
survey$ai_uneasy_r <- 6 - survey$ai_uneasy
survey$human_holdback_r <- 6 - survey$human_holdback
survey$human_uneasy_r <- 6 - survey$human_uneasy
survey$ai_disclosure_score <- rowMeans(survey[, c("ai_comfort", "ai_willing", "ai_holdback_r")])
survey$ai_emotional_score <- rowMeans(survey[, c("ai_relief", "ai_uneasy_r",
"ai_closure", "ai_lasting_relief")])
survey$human_disclosure_score <- rowMeans(survey[, c("human_comfort", "human_willing", "human_holdback_r")])
survey$human_emotional_score <- rowMeans(survey[, c("human_relief", "human_uneasy_r",
"human_closure", "human_lasting_relief")])
cronbach_alpha <- function(items) {
items <- na.omit(items)
k <- ncol(items)
(k / (k - 1)) * (1 - sum(apply(items, 2, var)) / var(rowSums(items)))
}
alpha_table <- data.frame(
scale = c("AI: willingness to disclose (3 items)",
"AI: post-disclosure relief (4 items)",
"Human: willingness to disclose (3 items)",
"Human: post-disclosure relief (4 items)"),
alpha = round(c(
cronbach_alpha(survey[, c("ai_comfort", "ai_willing", "ai_holdback_r")]),
cronbach_alpha(survey[, c("ai_relief", "ai_uneasy_r", "ai_closure", "ai_lasting_relief")]),
cronbach_alpha(survey[, c("human_comfort", "human_willing", "human_holdback_r")]),
cronbach_alpha(survey[, c("human_relief", "human_uneasy_r", "human_closure", "human_lasting_relief")])
), 2)
)
print(alpha_table)
## scale alpha
## 1 AI: willingness to disclose (3 items) 0.60
## 2 AI: post-disclosure relief (4 items) 0.79
## 3 Human: willingness to disclose (3 items) 0.64
## 4 Human: post-disclosure relief (4 items) 0.75
round(sapply(survey[, c("ai_disclosure_score", "human_disclosure_score",
"ai_emotional_score", "human_emotional_score")],
function(x) c(mean = mean(x), sd = sd(x))), 2)
## ai_disclosure_score human_disclosure_score ai_emotional_score
## mean 2.34 3.67 2.22
## sd 0.99 0.86 0.97
## human_emotional_score
## mean 3.84
## sd 0.82
write.csv(survey, "Team7_ReplikaSurvey_ANALYSIS.csv", row.names = FALSE)
get_mode <- function(x) {
counts <- table(na.omit(x))
modes <- as.numeric(names(counts)[counts == max(counts)])
paste(round(modes, 2), collapse = " / ")
}
describe5 <- function(v) {
x <- survey[[v]]
data.frame(Variable = v,
Mean = round(mean(x), 2),
Median = round(median(x), 2),
Mode = get_mode(x),
Min = round(min(x), 2),
Max = round(max(x), 2),
Range = round(max(x) - min(x), 2), # range = max - min
SD = round(sd(x), 2))
}
make_table <- function(vars) do.call(rbind, lapply(vars, describe5))
freq_vars <- c("ai_use", "ai_disclosure_freq", "human_disclosure_freq")
table1 <- make_table(freq_vars)
table1
## Variable Mean Median Mode Min Max Range SD
## 1 ai_use 3.14 3 4 1 5 4 1.37
## 2 ai_disclosure_freq 2.00 2 1 1 5 4 1.15
## 3 human_disclosure_freq 3.51 4 4 1 5 4 1.23
item_names <- c("comfort", "willing", "holdback", "judgment", "understanding",
"privacy", "relief", "uneasy", "closure", "lasting_relief")
item_vars <- as.vector(rbind(paste0("ai_", item_names), paste0("human_", item_names)))
table2 <- make_table(item_vars)
table2
## Variable Mean Median Mode Min Max Range SD
## 1 ai_comfort 2.16 2 1 1 5 4 1.21
## 2 human_comfort 3.90 4 5 1 5 4 1.12
## 3 ai_willing 2.31 2 1 1 5 4 1.31
## 4 human_willing 4.02 4 5 1 5 4 1.01
## 5 ai_holdback 3.45 4 5 1 5 4 1.44
## 6 human_holdback 2.90 3 2 1 5 4 1.23
## 7 ai_judgment 2.00 1 1 1 5 4 1.29
## 8 human_judgment 3.06 3 4 1 5 4 1.14
## 9 ai_understanding 1.90 1 1 1 5 4 1.18
## 10 human_understanding 3.73 4 4 1 5 4 1.13
## 11 ai_privacy 3.92 4 5 1 5 4 1.29
## 12 human_privacy 2.43 2 2 1 5 4 1.40
## 13 ai_relief 2.06 2 1 1 4 3 1.13
## 14 human_relief 3.98 4 4 1 5 4 1.05
## 15 ai_uneasy 3.12 3 3 / 4 1 5 4 1.38
## 16 human_uneasy 2.37 2 2 1 5 4 1.18
## 17 ai_closure 2.00 1 1 1 5 4 1.26
## 18 human_closure 3.92 4 4 2 5 3 0.95
## 19 ai_lasting_relief 1.96 1 1 1 5 4 1.17
## 20 human_lasting_relief 3.84 4 5 1 5 4 1.14
score_vars <- c("ai_disclosure_score", "human_disclosure_score",
"ai_emotional_score", "human_emotional_score")
table3 <- make_table(score_vars)
table3
## Variable Mean Median Mode Min Max Range SD
## 1 ai_disclosure_score 2.34 2.33 2.33 1.00 4.33 3.33 0.99
## 2 human_disclosure_score 3.67 4.00 4 / 4.33 1.67 5.00 3.33 0.86
## 3 ai_emotional_score 2.22 2.00 1 1.00 4.50 3.50 0.97
## 4 human_emotional_score 3.84 4.00 4 2.00 5.00 3.00 0.82
cat_table <- function(v) {
t <- table(survey[[v]])
data.frame(Variable = v, Category = names(t), n = as.integer(t),
Percent = round(100 * as.numeric(t) / sum(t), 1))
}
cat_vars <- c("gender", "age_group", "year", "area_study", "preferred_confidant")
table4 <- do.call(rbind, lapply(cat_vars, cat_table))
table4
## Variable Category n Percent
## 1 gender Man 18 36.7
## 2 gender Non-binary 2 4.1
## 3 gender Prefer not to say 5 10.2
## 4 gender Woman 24 49.0
## 5 age_group 18 to 19 13 26.5
## 6 age_group 20 to 21 26 53.1
## 7 age_group 22 to 24 7 14.3
## 8 age_group 25 or older 3 6.1
## 9 year Freshman 5 10.2
## 10 year Sophomore 10 20.4
## 11 year Junior 14 28.6
## 12 year Senior 14 28.6
## 13 year Graduate student 2 4.1
## 14 year BA degree 1 2.0
## 15 year Prefer not to say 3 6.1
## 16 area_study Architecture or design 4 8.2
## 17 area_study Arts and sciences 13 26.5
## 18 area_study Business or management 8 16.3
## 19 area_study Communications 4 8.2
## 20 area_study Education 1 2.0
## 21 area_study Engineering or computer science 5 10.2
## 22 area_study HDFS 1 2.0
## 23 area_study Healthcare 1 2.0
## 24 area_study Information studies or data 5 10.2
## 25 area_study International relations 1 2.0
## 26 area_study Political Science 3 6.1
## 27 area_study Prefer not to say 3 6.1
## 28 preferred_confidant A close friend 14 28.6
## 29 preferred_confidant A counselor or therapist 2 4.1
## 30 preferred_confidant A family member 8 16.3
## 31 preferred_confidant A romantic partner 15 30.6
## 32 preferred_confidant An AI chatbot 3 6.1
## 33 preferred_confidant Bsf and bf 1 2.0
## 34 preferred_confidant Dog 1 2.0
## 35 preferred_confidant No one 4 8.2
## 36 preferred_confidant The LORD 1 2.0
sum(!is.na(survey$explanation))
## [1] 48
measures <- c("disclosure_score", "emotional_score", "judgment", "understanding",
"privacy", "relief", "closure", "lasting_relief")
means_mat <- rbind(
"AI chatbot" = sapply(paste0("ai_", measures), function(v) mean(survey[[v]])),
"Close friend/family" = sapply(paste0("human_", measures), function(v) mean(survey[[v]]))
)
colnames(means_mat) <- c("Disclosure\nscore", "Relief\nscore", "Fear of\njudgment",
"Feeling\nunderstood", "Privacy\nconcern", "Immediate\nrelief",
"Closure", "Lasting\nrelief")
barplot(means_mat, beside = TRUE, ylim = c(0, 5.5), col = c("grey70", "grey25"),
ylab = "Mean rating (1 = strongly disagree, 5 = strongly agree)",
main = "Mean ratings by confidant (N = 49)", cex.names = 0.75,
legend.text = TRUE, args.legend = list(x = "top", horiz = TRUE, bty = "n"))
boxplot(survey[, score_vars], ylim = c(1, 5),
names = c("AI\ndisclosure", "Friend/family\ndisclosure", "AI\nrelief", "Friend/family\nrelief"),
ylab = "Scale score (1-5)", main = "Distribution of scale scores (N = 49)",
col = c("grey70", "grey25", "grey70", "grey25"))
PART 3
paired_test <- function(var, label, alt = "greater") {
human <- survey[[paste0("human_", var)]]
ai <- survey[[paste0("ai_", var)]]
diff <- human - ai
tt <- t.test(human, ai, paired = TRUE, alternative = alt)
ci <- t.test(human, ai, paired = TRUE)$conf.int
wt <- suppressWarnings(wilcox.test(human, ai, paired = TRUE,
alternative = alt, exact = FALSE))
data.frame(Test = label,
Tail = ifelse(alt == "greater", "one-tailed", "two-tailed"),
Mean_AI = round(mean(ai), 2),
Mean_Human = round(mean(human), 2),
Mean_diff = round(mean(diff), 2),
CI_low = round(ci[1], 2),
CI_high = round(ci[2], 2),
t = round(unname(tt$statistic), 2),
df = unname(tt$parameter),
p = tt$p.value,
Cohens_d = round(mean(diff) / sd(diff), 2), # d for paired data (Cohen's dz)
Wilcoxon_p = wt$p.value,
Shapiro_p = round(shapiro.test(diff)$p.value, 3)) # normality of the differences
}
results <- rbind(
paired_test("disclosure_score", "H1: Willingness to disclose (score)"),
paired_test("judgment", "H2: Fear of judgment"),
paired_test("understanding", "H3: Perceived understanding"),
paired_test("closure", "H4a: Closure"),
paired_test("lasting_relief", "H4a: Lasting relief"),
paired_test("relief", "H4b: Immediate relief", alt = "two.sided"),
paired_test("emotional_score", "Supplementary: Relief (score)", alt = "two.sided"),
paired_test("privacy", "Supplementary: Privacy concern", alt = "two.sided")
)
results$p_holm <- p.adjust(results$p, method = "holm")
fmt_p <- function(p) ifelse(p < .001, "< .001", sprintf("%.3f", p))
report <- results
report$p <- fmt_p(results$p)
report$p_holm <- fmt_p(results$p_holm)
report$Wilcoxon_p <- fmt_p(results$Wilcoxon_p)
report
## Test Tail Mean_AI Mean_Human Mean_diff
## 1 H1: Willingness to disclose (score) one-tailed 2.34 3.67 1.33
## 2 H2: Fear of judgment one-tailed 2.00 3.06 1.06
## 3 H3: Perceived understanding one-tailed 1.90 3.73 1.84
## 4 H4a: Closure one-tailed 2.00 3.92 1.92
## 5 H4a: Lasting relief one-tailed 1.96 3.84 1.88
## 6 H4b: Immediate relief two-tailed 2.06 3.98 1.92
## 7 Supplementary: Relief (score) two-tailed 2.22 3.84 1.62
## 8 Supplementary: Privacy concern two-tailed 3.92 2.43 -1.49
## CI_low CI_high t df p Cohens_d Wilcoxon_p Shapiro_p p_holm
## 1 0.91 1.75 6.37 48 < .001 0.91 < .001 0.708 < .001
## 2 0.60 1.52 4.61 48 < .001 0.66 < .001 0.007 < .001
## 3 1.33 2.35 7.26 48 < .001 1.04 < .001 0.001 < .001
## 4 1.45 2.38 8.30 48 < .001 1.19 < .001 0.001 < .001
## 5 1.38 2.37 7.61 48 < .001 1.09 < .001 0.001 < .001
## 6 1.45 2.39 8.23 48 < .001 1.18 < .001 0.003 < .001
## 7 1.23 2.00 8.47 48 < .001 1.21 < .001 0.418 < .001
## 8 -1.98 -1.00 -6.14 48 < .001 -0.88 < .001 0.002 < .001