I wonder how to get statistical data of a ggplot with geom_smooth. I tried with stat_cor but I am not sure if its the right values for the line from geom_smooth and I don't know how to add r-squared. In the best case I would like to have summary function like in a normal regression just for geom-smooth. I don't know if this is possible. Thanks for your help. Code and Graph is below.
GAMFORMULA<-y~s(x,k=3,fx=F)
#BHD~Höhe
g<- ggplot(data = data_clean) +
geom_point(mapping = aes(x = BHD, y = Höhe, color = Soziale.Stellung)) +
geom_smooth(method = "gam", mapping = aes(x = BHD, y = Höhe),
color = "red", formula = GAMFORMULA) +
xlab("BHD in cm") +
ylab("Höhe in m")
g + stat_cor(method = "pearson",mapping = aes(x = BHD, y = Höhe),
formula = GAMFORMULA)