我用这段代码得到了一个带有对数公式的图
df %>%
mutate(absVO2 = absVO2*1000) %>%
ggplot(aes(x = VE, y = absVO2, color = group)) +
geom_point(size = 0.5) +
geom_smooth(aes(colour=group), method = "lm", formula = y ~ log(x)) +
stat_regline_equation(label.x = 25, label.y = c(2400,2800),
formula = y ~ log(x),
aes(color = group, label = paste(..eq.label.., ..adj.rr.label.., sep = "~~~~")),) +
xlab("VE (L/min)") +
ylab(expression(paste("V", O[2]," (mL/min)"))) +
scale_x_continuous(limits = c(0, 100), breaks = seq(0, 100, by = 25)) +
theme_classic() +
theme(
panel.background = element_rect(fill ="white", colour = "white"),
axis.line = element_line(colour = "black"),
legend.title = element_text(face = "bold"),
legend.position = "none",
strip.text = element_blank()
)
这将给出以下输出:
我想统计比较两个斜率,即910
和970
,它们是VO2 = a * log(VE) + b
公式中的a
。
谢谢大家!
数据如下:
structure(list(VE = c(22.75, 23.75, 26.75, 32.5, 39.5, 48.25,
55.75, 24, 26.5, 29, 36.5, 44.75, 55.25, 63.75, 78, 19, 20.75,
25, 29, 39.25, 51, 25, 25.5, 28.5, 34.25, 35.5, 40.25, 47, 52.5,
59.5, 64.5, 83, 92.25, 18.25, 19.75, 20.75, 23.5, 26.25, 28,
32.75, 37.25, 24.25, 26.75, 29.5, 31, 32, 39, 43.25, 46.25, 51.75,
52.75, 64.5, 72.75, 15.75, 16.25, 20.25, 28, 34.75, 45.75, 64.75,
18.25, 21.25, 22.25, 24.75, 29.5, 21.25, 20.75, 26, 30.75, 34,
38.5, 46.75, 53.75, 70.5, 82.75, 98.25, 17.25, 22, 25.75, 29.75,
33.75, 38.75, 44.5, 50.75, 56.25, 65, 71.75, 81, 99, 30, 29,
29.75, 38.25, 40.75, 47.25, 52.75, 65.5, 22.75, 24.75, 28.75,
34, 48, 53.75, 61.5, 73.75, 22, 21.75, 24.25, 28, 34.5, 40, 48.5
), absVO2 = c(0.739, 0.81975, 0.95125, 1.07525, 1.199, 1.34575,
1.49775, 0.66125, 0.7485, 0.855, 0.9845, 1.1495, 1.3465, 1.451,
1.5985, 0.61675, 0.717, 0.86275, 0.98575, 1.13, 1.262, 0.8835,
0.94575, 1.08125, 1.244, 1.30475, 1.4735, 1.679, 1.79075, 1.96,
2.0405, 2.34425, 2.4435, 0.5925, 0.661, 0.7435, 0.87875, 0.9435,
0.99675, 1.11425, 1.20275, 0.9255, 1.02925, 1.11675, 1.19725,
1.24775, 1.42625, 1.54225, 1.59425, 1.69675, 1.776, 1.94525,
2.0395, 0.535, 0.5845, 0.76875, 0.982, 1.09975, 1.259, 1.3265,
0.7205, 0.86825, 0.9235, 1.01075, 1.17275, 0.7435, 0.76575, 0.96075,
1.0975, 1.21975, 1.34525, 1.50625, 1.6755, 1.86325, 2.0465, 2.1395,
0.613, 0.85525, 0.98, 1.076, 1.287, 1.4615, 1.59325, 1.6965,
1.884, 1.998, 2.1425, 2.31275, 2.474, 0.81075, 0.8035, 0.8645,
1.076, 1.119, 1.255, 1.33825, 1.499, 0.8105, 0.8865, 1.03725,
1.134, 1.26675, 1.36275, 1.4455, 1.52875, 0.64675, 0.6645, 0.742,
0.81675, 0.983, 1.06875, 1.155), group = c("CAD", "CAD", "CAD",
"CAD", "CAD", "CAD", "CAD", "CAD", "CAD", "CAD", "CAD", "CAD",
"CAD", "CAD", "CAD", "Healthy", "Healthy", "Healthy", "Healthy",
"Healthy", "Healthy", "Healthy", "Healthy", "Healthy", "Healthy",
"Healthy", "Healthy", "Healthy", "Healthy", "Healthy", "Healthy",
"Healthy", "Healthy", "Healthy", "Healthy", "Healthy", "Healthy",
"Healthy", "Healthy", "Healthy", "Healthy", "CAD", "CAD", "CAD",
"CAD", "CAD", "CAD", "CAD", "CAD", "CAD", "CAD", "CAD", "CAD",
"Healthy", "Healthy", "Healthy", "Healthy", "Healthy", "Healthy",
"Healthy", "Healthy", "Healthy", "Healthy", "Healthy", "Healthy",
"CAD", "CAD", "CAD", "CAD", "CAD", "CAD", "CAD", "CAD", "CAD",
"CAD", "CAD", "Healthy", "Healthy", "Healthy", "Healthy", "Healthy",
"Healthy", "Healthy", "Healthy", "Healthy", "Healthy", "Healthy",
"Healthy", "Healthy", "CAD", "CAD", "CAD", "CAD", "CAD", "CAD",
"CAD", "CAD", "Healthy", "Healthy", "Healthy", "Healthy", "Healthy",
"Healthy", "Healthy", "Healthy", "CAD", "CAD", "CAD", "CAD",
"CAD", "CAD", "CAD")), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -112L))
1条答案
按热度按时间vom3gejh1#
假设两个组的斜率不同。为了回答这个问题,您需要构建一个线性模型,其中添加了组变量以及组和VE之间的交互作用(如果没有交互作用,您将假设两个组之间的斜率相同,因此在这种情况下您已经有了答案):
Intercept
是log(VE)
为零时的absVO 2值(对您的数据没有实际意义)和group = CAD
(这是参考组,您可以更改)。log(VE)
是您感兴趣的术语(斜率),对于group = CAD
大约为914,对于group = healthy
,您必须将其增加大约60(这将导致斜率约为974),但该系数不显著(基于PR(t)列-可怕的p值)。