library(readxl)
data <- read_excel("C:/Users/24966/Desktop/Excercise/307676931_按文本_电影文化挪用效果调查问卷_256_256.xlsx")
names(data)[which(names(data) == "3、您对电影《花木兰》的满意度有多高?")] <- "mulan_satisfaction"
names(data)[which(names(data) == "4、您认为电影《花木兰》多大程度上体现出花木兰历史故事的文化内涵?")] <- "mulan_culture"
names(data)[which(names(data) == "5、您认为电影《花木兰》中中国文化元素的含量有多高")] <- "mulan_elements"回归满意度影响
Quarto
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org.
Running Code
数据读取
花木兰单变量回归
model_1 <- lm(mulan_satisfaction ~ mulan_culture, data = data)
model_2 <- lm(mulan_satisfaction ~ mulan_elements, data = data)花木兰多元回归
model_3 <- lm(mulan_satisfaction ~ mulan_culture+mulan_elements, data = data)功夫熊猫单变量回归
names(data)[which(names(data) == "6、您对电影《功夫熊猫》的满意度有多高?")] <- "panda_satisfaction"
names(data)[which(names(data) == "7、您认为电影《功夫熊猫》多大程度上体现出中国功夫的文化内涵")] <- "panda_kungfu"
names(data)[which(names(data) == "8、您认为电影《功夫熊猫》中中国文化元素的含量有多高")] <- "panda_elements"
# 去除缺失值
df <- na.omit(data[, c("panda_satisfaction", "panda_kungfu", "panda_elements")])
# 多元线性回归模型
model_4 <- lm(panda_satisfaction ~ panda_kungfu , data = df)
model_5 <- lm(panda_satisfaction ~ panda_elements, data = df)功夫熊猫多元回归
model_6 <- lm(panda_satisfaction ~ panda_kungfu+panda_elements , data = df)# 重命名列(推荐,可避免中文出错)
names(data)[which(names(data) == "9、您接触或学习外来文化的兴趣有多高?")] <- "interest_foreign"
names(data)[which(names(data) == "10、您认为外来文化对社会的重要性如何?")] <- "importance_foreign"
names(data)[which(names(data) == "11、您认为文化交融会促进本土文化的发展吗?")] <- "integration_effect"
# 计算这三列的行平均值,创建新变量
data$insider_acceptance <- rowMeans(data[, c("interest_foreign", "importance_foreign", "integration_effect")], na.rm = TRUE)
# 查看结果
head(data[, c("interest_foreign", "importance_foreign", "integration_effect", "insider_acceptance")])# A tibble: 6 × 4
interest_foreign importance_foreign integration_effect insider_acceptance
<dbl> <dbl> <dbl> <dbl>
1 7 7 7 7
2 4 4 4 4
3 6 5 7 6
4 5 3 4 4
5 6 6 7 6.33
6 6 4 4 4.67
包容度和满意度回归(功夫熊猫)
model_7 <- lm(panda_satisfaction ~insider_acceptance , data = data)model_8 <- lm(mulan_satisfaction ~ insider_acceptance, data = data)summary(model_1)
Call:
lm(formula = mulan_satisfaction ~ mulan_culture, data = data)
Residuals:
Min 1Q Median 3Q Max
-3.9470 -0.2433 0.0530 0.2011 3.7567
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.68781 0.15024 4.578 7.34e-06 ***
mulan_culture 0.85184 0.03119 27.308 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.7302 on 255 degrees of freedom
Multiple R-squared: 0.7452, Adjusted R-squared: 0.7442
F-statistic: 745.7 on 1 and 255 DF, p-value: < 2.2e-16
summary(model_2)
Call:
lm(formula = mulan_satisfaction ~ mulan_elements, data = data)
Residuals:
Min 1Q Median 3Q Max
-3.7219 -0.5588 0.1151 0.4412 3.9520
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.53713 0.20107 2.671 0.00804 **
mulan_elements 0.83695 0.03988 20.984 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.876 on 255 degrees of freedom
Multiple R-squared: 0.6333, Adjusted R-squared: 0.6318
F-statistic: 440.3 on 1 and 255 DF, p-value: < 2.2e-16
summary(model_3)
Call:
lm(formula = mulan_satisfaction ~ mulan_culture + mulan_elements,
data = data)
Residuals:
Min 1Q Median 3Q Max
-3.2661 -0.2134 0.0352 0.2367 3.3365
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.23349 0.15825 1.475 0.141
mulan_culture 0.61706 0.04776 12.921 < 2e-16 ***
mulan_elements 0.31577 0.05090 6.204 2.22e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.6818 on 254 degrees of freedom
Multiple R-squared: 0.7787, Adjusted R-squared: 0.777
F-statistic: 446.9 on 2 and 254 DF, p-value: < 2.2e-16
summary(model_4)
Call:
lm(formula = panda_satisfaction ~ panda_kungfu, data = df)
Residuals:
Min 1Q Median 3Q Max
-5.5984 -0.2740 0.0638 0.4016 2.7127
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.96288 0.25758 7.621 4.97e-13 ***
panda_kungfu 0.66222 0.04655 14.227 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.8408 on 255 degrees of freedom
Multiple R-squared: 0.4425, Adjusted R-squared: 0.4403
F-statistic: 202.4 on 1 and 255 DF, p-value: < 2.2e-16
summary(model_5)
Call:
lm(formula = panda_satisfaction ~ panda_elements, data = df)
Residuals:
Min 1Q Median 3Q Max
-5.5330 -0.2435 0.1118 0.4670 2.4012
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.0198 0.2672 7.558 7.36e-13 ***
panda_elements 0.6447 0.0478 13.487 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.8603 on 255 degrees of freedom
Multiple R-squared: 0.4164, Adjusted R-squared: 0.4141
F-statistic: 181.9 on 1 and 255 DF, p-value: < 2.2e-16
summary(model_6)
Call:
lm(formula = panda_satisfaction ~ panda_kungfu + panda_elements,
data = df)
Residuals:
Min 1Q Median 3Q Max
-5.6904 -0.3169 0.0418 0.3625 2.5063
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.56466 0.26465 5.912 1.08e-08 ***
panda_kungfu 0.41163 0.07248 5.679 3.70e-08 ***
panda_elements 0.32062 0.07275 4.407 1.55e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.812 on 254 degrees of freedom
Multiple R-squared: 0.4821, Adjusted R-squared: 0.478
F-statistic: 118.2 on 2 and 254 DF, p-value: < 2.2e-16
summary(model_7)
Call:
lm(formula = panda_satisfaction ~ insider_acceptance, data = data)
Residuals:
Min 1Q Median 3Q Max
-4.2634 -0.6128 0.0860 0.6883 2.7848
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.6429 0.3490 7.573 6.71e-13 ***
insider_acceptance 0.5241 0.0619 8.467 2.02e-15 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.9949 on 255 degrees of freedom
Multiple R-squared: 0.2194, Adjusted R-squared: 0.2164
F-statistic: 71.68 on 1 and 255 DF, p-value: 2.015e-15
summary(model_8)
Call:
lm(formula = mulan_satisfaction ~ insider_acceptance, data = data)
Residuals:
Min 1Q Median 3Q Max
-4.0855 -0.6374 0.1385 0.9145 3.2587
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.73324 0.49337 5.54 7.53e-08 ***
insider_acceptance 0.33603 0.08751 3.84 0.000155 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.406 on 255 degrees of freedom
Multiple R-squared: 0.05466, Adjusted R-squared: 0.05096
F-statistic: 14.75 on 1 and 255 DF, p-value: 0.0001553
可视化
library(ggplot2)
library(ggpubr)
# 拟合模型
fit <- lm(panda_satisfaction ~ insider_acceptance, data = data)
summary_fit <- summary(fit)
eq <- paste0("y = ", round(coef(fit)[1], 2),
ifelse(coef(fit)[2] >= 0, " + ", " - "),
abs(round(coef(fit)[2], 2)), " * x")
r2 <- round(summary_fit$r.squared, 2)
p_value <- signif(summary_fit$coefficients[2,4], 2)
cor_r <- round(cor(data$insider_acceptance, data$panda_satisfaction, use = "complete.obs"), 2)
# 合并文本注释
annotation_text <- paste0("italic(", eq, ")~','~italic(R)^2 == ", r2,
"~','~italic(r) == ", cor_r,
"~','~italic(p) == ", p_value)
# 绘图
ggplot(data, aes(x = insider_acceptance, y = panda_satisfaction)) +
geom_point(alpha = 0.6) +
geom_smooth(method = "lm", color = "blue") +
annotate("text",
x = min(data$insider_acceptance, na.rm = TRUE) + 0.3,
y = max(data$panda_satisfaction, na.rm = TRUE) - 0.3,
label = annotation_text,
parse = TRUE,
hjust = 0, size = 5) +
labs(
title = "Personal Tolerance Effect on Pandas Satisfaction",
x = "Personal Tolerance of Foreign Cultures",
y = "Pandas Satisfaction"
) +
theme_minimal()`geom_smooth()` using formula = 'y ~ x'
df$fitted <- fitted(model_8)
df$residuals <- resid(model_8)
library(ggplot2)
library(ggpubr)
# 拟合模型
fit_mulan <- lm(mulan_satisfaction ~ insider_acceptance, data = data)
summary_fit_mulan <- summary(fit_mulan)
eq_mulan <- paste0("y = ", round(coef(fit_mulan)[1], 2),
ifelse(coef(fit_mulan)[2] >= 0, " + ", " - "),
abs(round(coef(fit_mulan)[2], 2)), " * x")
r2_mulan <- round(summary_fit_mulan$r.squared, 2)
p_value_mulan <- signif(summary_fit_mulan$coefficients[2,4], 2)
cor_r_mulan <- round(cor(data$insider_acceptance, data$mulan_satisfaction, use = "complete.obs"), 2)
# 合并成一行注释
annotation_text_mulan <- paste0("italic(", eq_mulan, ")~','~italic(R)^2 == ", r2_mulan,
"~','~italic(r) == ", cor_r_mulan,
"~','~italic(p) == ", p_value_mulan)
# 绘图
ggplot(data, aes(x = insider_acceptance, y = mulan_satisfaction)) +
geom_point(alpha = 0.6) +
geom_smooth(method = "lm", color = "blue") +
annotate("text",
x = min(data$insider_acceptance, na.rm = TRUE) + 0.3,
y = max(data$mulan_satisfaction, na.rm = TRUE) - 0.3,
label = annotation_text_mulan,
parse = TRUE, hjust = 0, size = 5) +
labs(
title = "Personal Tolerance Effect on Mulan Satisfaction",
x = "Personal Tolerance of Foreign Cultures",
y = "Mulan Satisfaction"
) +
theme_minimal()`geom_smooth()` using formula = 'y ~ x'
df$fitted <- fitted(model_5)
df$residuals <- resid(model_5)
library(ggplot2)
library(ggpubr)
# 拟合线性模型
fit_panda <- lm(panda_satisfaction ~ panda_elements, data = data)
summary_fit_panda <- summary(fit_panda)
eq_panda <- paste0("y = ", round(coef(fit_panda)[1], 2),
ifelse(coef(fit_panda)[2] >= 0, " + ", " - "),
abs(round(coef(fit_panda)[2], 2)), " * x")
r2_panda <- round(summary_fit_panda$r.squared, 2)
p_value_panda <- signif(summary_fit_panda$coefficients[2,4], 2)
cor_r_panda <- round(cor(data$panda_elements, data$panda_satisfaction, use = "complete.obs"), 2)
# 拼接注释文字
annotation_text_panda <- paste0("italic(", eq_panda, ")~','~italic(R)^2 == ", r2_panda,
"~','~italic(r) == ", cor_r_panda,
"~','~italic(p) == ", p_value_panda)
# 画图
ggplot(data, aes(x = panda_elements, y = panda_satisfaction)) +
geom_point(alpha = 0.6) +
geom_smooth(method = "lm", color = "blue") +
annotate("text",
x = min(data$panda_elements, na.rm = TRUE) + 0.3,
y = max(data$panda_satisfaction, na.rm = TRUE) - 0.3,
label = annotation_text_panda,
parse = TRUE, hjust = 0, size = 5) +
labs(
title = "Pandas Cultural Elements Effect on Pandas Satisfaction",
x = "Pandas Cultural Elements Amount",
y = "Pandas Satisfaction"
) +
theme_minimal()`geom_smooth()` using formula = 'y ~ x'
df$fitted <- fitted(model_4)
df$residuals <- resid(model_4)
library(ggplot2)
library(ggpubr)
# 拟合线性模型
fit_kungfu <- lm(panda_satisfaction ~ panda_kungfu, data = data)
summary_fit_kungfu <- summary(fit_kungfu)
eq_kungfu <- paste0("y = ", round(coef(fit_kungfu)[1], 2),
ifelse(coef(fit_kungfu)[2] >= 0, " + ", " - "),
abs(round(coef(fit_kungfu)[2], 2)), " * x")
r2_kungfu <- round(summary_fit_kungfu$r.squared, 2)
p_value_kungfu <- signif(summary_fit_kungfu$coefficients[2,4], 2)
cor_r_kungfu <- round(cor(data$panda_kungfu, data$panda_satisfaction, use = "complete.obs"), 2)
# 拼接注释文字
annotation_text_kungfu <- paste0("italic(", eq_kungfu, ")~','~italic(R)^2 == ", r2_kungfu,
"~','~italic(r) == ", cor_r_kungfu,
"~','~italic(p) == ", p_value_kungfu)
# 绘图
ggplot(data, aes(x = panda_kungfu, y = panda_satisfaction)) +
geom_point(alpha = 0.6) +
geom_smooth(method = "lm", color = "blue") +
annotate("text",
x = min(data$panda_kungfu, na.rm = TRUE) + 0.3,
y = max(data$panda_satisfaction, na.rm = TRUE) - 0.3,
label = annotation_text_kungfu,
parse = TRUE, hjust = 0, size = 5) +
labs(
title = "Pandas Kungfu Meaning Relevance Effect on Pandas Satisfaction",
x = "Panndas Kungfu Meaning Relevance Amount",
y = "Pandas Satisfaction"
) +
theme_minimal()`geom_smooth()` using formula = 'y ~ x'
df$fitted <- fitted(model_2)
df$residuals <- resid(model_2)
library(ggplot2)
library(ggpubr)
# 拟合线性模型
fit_mulan_elem <- lm(mulan_satisfaction ~ mulan_elements, data = data)
summary_fit_mulan_elem <- summary(fit_mulan_elem)
eq_mulan_elem <- paste0("y = ", round(coef(fit_mulan_elem)[1], 2),
ifelse(coef(fit_mulan_elem)[2] >= 0, " + ", " - "),
abs(round(coef(fit_mulan_elem)[2], 2)), " * x")
r2_mulan_elem <- round(summary_fit_mulan_elem$r.squared, 2)
p_value_mulan_elem <- signif(summary_fit_mulan_elem$coefficients[2,4], 2)
cor_r_mulan_elem <- round(cor(data$mulan_elements, data$mulan_satisfaction, use = "complete.obs"), 2)
# 拼接注释文字
annotation_text_mulan_elem <- paste0("italic(", eq_mulan_elem, ")~','~italic(R)^2 == ", r2_mulan_elem,
"~','~italic(r) == ", cor_r_mulan_elem,
"~','~italic(p) == ", p_value_mulan_elem)
# 绘图
ggplot(data, aes(x = mulan_elements, y = mulan_satisfaction)) +
geom_point(alpha = 0.6) +
geom_smooth(method = "lm", color = "blue") +
annotate("text",
x = min(data$mulan_elements, na.rm = TRUE) + 0.3,
y = max(data$mulan_satisfaction, na.rm = TRUE) - 0.3,
label = annotation_text_mulan_elem,
parse = TRUE, hjust = 0, size = 5) +
labs(
title = "Mulan Chinese Cultural Elements Effect on Mulan Satisfaction",
x = "Mulan Chinese Cultural Elements Amount",
y = "Mulan Satisfaction"
) +
theme_minimal()`geom_smooth()` using formula = 'y ~ x'
df$fitted <- fitted(model_1)
df$residuals <- resid(model_1)
library(ggplot2)
library(ggpubr)
# 拟合模型
fit_mulan_culture <- lm(mulan_satisfaction ~ mulan_culture, data = data)
summary_fit_mulan_culture <- summary(fit_mulan_culture)
eq_mulan_culture <- paste0("y = ", round(coef(fit_mulan_culture)[1], 2),
ifelse(coef(fit_mulan_culture)[2] >= 0, " + ", " - "),
abs(round(coef(fit_mulan_culture)[2], 2)), " * x")
r2_mulan_culture <- round(summary_fit_mulan_culture$r.squared, 2)
p_value_mulan_culture <- signif(summary_fit_mulan_culture$coefficients[2,4], 2)
cor_r_mulan_culture <- round(cor(data$mulan_culture, data$mulan_satisfaction, use = "complete.obs"), 2)
# 拼接注释
annotation_text_mulan_culture <- paste0("italic(", eq_mulan_culture, ")~','~italic(R)^2 == ", r2_mulan_culture,
"~','~italic(r) == ", cor_r_mulan_culture,
"~','~italic(p) == ", p_value_mulan_culture)
# 绘图
ggplot(data, aes(x = mulan_culture, y = mulan_satisfaction)) +
geom_point(alpha = 0.6) +
geom_smooth(method = "lm", color = "blue") +
annotate("text",
x = min(data$mulan_culture, na.rm = TRUE) + 0.3,
y = max(data$mulan_satisfaction, na.rm = TRUE) - 0.3,
label = annotation_text_mulan_culture,
parse = TRUE, hjust = 0, size = 5) +
labs(
title = "Mulan History Meaning Relevance Effect on Mulan Satisfaction",
x = "Mulan History Meaning Relevance Amount",
y = "Mulan Satisfaction"
) +
theme_minimal()`geom_smooth()` using formula = 'y ~ x'
model_9 <- lm(mulan_satisfaction ~ mulan_culture+mulan_elements+insider_acceptance, data = data)
summary(model_9)
Call:
lm(formula = mulan_satisfaction ~ mulan_culture + mulan_elements +
insider_acceptance, data = data)
Residuals:
Min 1Q Median 3Q Max
-3.1565 -0.2666 0.0777 0.2134 3.3696
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.03798 0.25830 -0.147 0.883
mulan_culture 0.61691 0.04768 12.938 < 2e-16 ***
mulan_elements 0.30548 0.05141 5.942 9.27e-09 ***
insider_acceptance 0.05805 0.04369 1.329 0.185
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.6808 on 253 degrees of freedom
Multiple R-squared: 0.7803, Adjusted R-squared: 0.7776
F-statistic: 299.4 on 3 and 253 DF, p-value: < 2.2e-16
library(lm.beta)
model_9 <- lm(mulan_satisfaction ~ mulan_culture + mulan_elements + insider_acceptance, data = data)
model_9_beta <- lm.beta(model_9)
summary(model_9_beta)
Call:
lm(formula = mulan_satisfaction ~ mulan_culture + mulan_elements +
insider_acceptance, data = data)
Residuals:
Min 1Q Median 3Q Max
-3.1565 -0.2666 0.0777 0.2134 3.3696
Coefficients:
Estimate Standardized Std. Error t value Pr(>|t|)
(Intercept) -0.03798 NA 0.25830 -0.147 0.883
mulan_culture 0.61691 0.62517 0.04768 12.938 < 2e-16 ***
mulan_elements 0.30548 0.29045 0.05141 5.942 9.27e-09 ***
insider_acceptance 0.05805 0.04039 0.04369 1.329 0.185
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.6808 on 253 degrees of freedom
Multiple R-squared: 0.7803, Adjusted R-squared: 0.7776
F-statistic: 299.4 on 3 and 253 DF, p-value: < 2.2e-16
library(ggplot2)
# 多元线性模型
fit <- lm(panda_satisfaction ~ panda_elements + panda_kungfu + insider_acceptance, data = data)
summary_fit <- summary(fit)
# 提取系数
coefs <- round(coef(fit), 2)
r2 <- round(summary_fit$r.squared, 2)
p_value <- signif(summary_fit$fstatistic["value"], 2) # F 统计量的 p 值没有直接给,要单独查
f_p <- signif(pf(summary_fit$fstatistic[1],
summary_fit$fstatistic[2],
summary_fit$fstatistic[3],
lower.tail = FALSE), 2)
# 拼接多元方程(类似 y = b0 + b1*x1 + b2*x2 + b3*x3)
eq_text <- paste0(
"y == ", coefs[1],
ifelse(coefs[2] >= 0, " + ", " - "), abs(coefs[2]), " * x[1]",
ifelse(coefs[3] >= 0, " + ", " - "), abs(coefs[3]), " * x[2]",
ifelse(coefs[4] >= 0, " + ", " - "), abs(coefs[4]), " * x[3]",
"~','~italic(R)^2 == ", r2,
"~','~italic(p) == ", f_p
)
# 画图:选择一个变量和结果变量作图,其余作为模型注释
ggplot(data, aes(x = panda_elements, y = panda_satisfaction)) +
geom_point(alpha = 0.6) +
geom_smooth(method = "lm", formula = y ~ x, color = "blue") +
annotate("text",
x = min(data$panda_elements, na.rm = TRUE) + 0.2,
y = max(data$panda_satisfaction, na.rm = TRUE) - 0.3,
label = eq_text,
parse = TRUE, hjust = 0, size = 5) +
labs(
title = "Multivariate Effect on Pandas Satisfaction",
x = "Pandas Overall Impression",
y = "Pandas Satisfaction"
) +
theme_minimal()library(ggplot2)
# 拟合模型
fit <- lm(mulan_satisfaction ~ mulan_culture + mulan_elements + insider_acceptance, data = data)
summary_fit <- summary(fit)
# 提取系数
coefs <- round(coef(fit), 2)
r2 <- round(summary_fit$r.squared, 2)
f_p <- signif(pf(summary_fit$fstatistic[1],
summary_fit$fstatistic[2],
summary_fit$fstatistic[3],
lower.tail = FALSE), 2)
# 拼接多元回归公式(带 parse 格式)
eq_text <- paste0(
"y == ", coefs[1],
ifelse(coefs[2] >= 0, " + ", " - "), abs(coefs[2]), " * x[1]",
ifelse(coefs[3] >= 0, " + ", " - "), abs(coefs[3]), " * x[2]",
ifelse(coefs[4] >= 0, " + ", " - "), abs(coefs[4]), " * x[3]",
"~','~italic(R)^2 == ", r2,
"~','~italic(p) == ", f_p
)
# 可视化(x轴用 mulan_culture 做展示,其它作为模型变量标注)
ggplot(data, aes(x = mulan_culture, y = mulan_satisfaction)) +
geom_point(alpha = 0.6) +
geom_smooth(method = "lm", formula = y ~ x, color = "blue") +
annotate("text",
x = min(data$mulan_culture, na.rm = TRUE) + 0.2,
y = max(data$mulan_satisfaction, na.rm = TRUE) - 0.3,
label = eq_text,
parse = TRUE, hjust = 0, size = 5) +
labs(
title = "Multivariate Effect on Mulan Satisfaction",
x = "Mulan Overall Impression",
y = "Mulan Satisfaction"
) +
theme_minimal()