Я хотел бы показать уровни значимости (***
или n.s.
) в качестве меток в моей линейной регрессии, используя ggpubr
в R. Похоже, что это делается с помощью aes(label = ..p.signif..)
, как указано здесь: https://www.r -bloggers.com / add-p-значения-и-значимости-уровней-для-ggplots /
Однако, когда я просто заменяю ..p.label..
на ..p.signif..
в моем stat_cor(aes(label = paste(..rr.label.., ..p.label.., sep = "~
, ~"))
т.е.stat_cor (aes (label = paste (.. rr.label .., ..p.signif .., sep = "~ ,
~")) `ничего на моем графике не изменилось, просто я получаю ошибку:
Error in paste(rr.label, p.signif, sep = "~`,`~") :
object 'p.signif' not found
Пожалуйста, как я могу нанести значения звезд (*, , *) или ns вместо точных значений p на моем графике? Большое спасибо.
Мои фиктивные данные: (заимствовано из http://www.sthda.com/english/articles/24-ggpubr-publication-ready-plots/78-perfect-scatter-plots-with-correlation-and-marginal-histograms/)
library(ggpubr)
data("mtcars")
df <- mtcars
df$cyl <- as.factor(df$cyl)
ggscatter(df, x = "wt", y = "mpg",
add = "reg.line", # Add regression line
conf.int = TRUE, # Add confidence interval
color = "cyl", palette = "jco", # Color by groups "cyl"
shape = "cyl" # Change point shape by groups "cyl"
)+
stat_cor(aes(color = cyl,
label =paste(..rr.label.., ..p.label.., sep = "~`,`~")), # HOW TO CHANGE p.label to show stars???
label.x = 3) # Add correlation coefficient
![enter image description here](https://i.stack.imgur.com/tBxZh.png)