【发布时间】:2019-01-09 08:36:49
【问题描述】:
Columns and first rows of code
我在ggplot2 的同一个geom_point 图中有几个不同的geom_smooth(method="glm") 行。我正在寻找确定每条线的回归方程,包括斜率方程。我找到了similar post,但我仍然遇到一些问题。我的代码是:
native <- read.csv("native.gather.C4C5C6C7.csv")
ggplot(native, aes(x=YearsPostRelease, y=PercentNative, col=FieldType, linetype=FieldType)) +
geom_point(size=0.7) +
geom_smooth(data = native,
method ="glm", alpha = 0, show.legend = FALSE, linetype = 'solid') +
scale_x_continuous(breaks = c(0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55)) +
scale_y_continuous(limits = c(0, 100),
breaks = c(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100)) +
ggtitle("Percent Native Through Time")
提前致谢!
【问题讨论】:
-
请附上类似帖子的链接,以供参考。查看您的数据是什么样子也会很有帮助,请提供示例。
-
这里是链接:stackoverflow.com/questions/7549694/… 我还添加了数据的图像。对不起,第一次在这个网站上发布海报。谢谢
-
您要准确添加哪些行?您可以根据需要添加任意数量的
geom_smooth()层。我不清楚你的问题到底是什么。 -
我已经用该代码添加了行,我正在寻找确定每行的斜率以进行进一步的统计分析。我不能使用 r2 值,因为每行之间的样本量非常不同
-
也就是说,您想要回归方程的详细信息?