p values , r squared value and regression equation on ggplot : R programming
Автор: Rajendra Choure
Загружено: Aug 19, 2021
Просмотров: 10,104 views
#ggplot2 #rprogramming #annotationonplot #p-value, # r-squaredvalue #datavisualisation #scatterplot #smoothline
This video describes how to add p value, r-squared value and regression equation on ggplot2 plot.
Scatter plot with p values, r-squared value and equation of linear regression model
Data
conc=c(0 ,0, 0,10,10,10,20,20,20,30,30,30,40,40,40,50,50,50,
60,60,60,70,70,70,80,80,80,90,90,90, 100, 100 ,100)
OD = c(0.00,0.00,0.00,0.05,0.03,0.05,0.10,0.13,0.11,0.17,
0.15,0.15,0.23,0.23,0.22,0.28,0.29,0.27,0.41,0.46,
0.39,0.50,0.49,0.45,0.53,0.54,0.53,0.64,0.65,0.60,
0.74,0.69,0.73)
df=data.frame(conc,OD)
lmod= lm(OD~conc,df)
summary(lmod)
library(ggplot2)
ggplot(df,aes(conc,OD))+
geom_point()+
geom_smooth(method="lm",se=0)+
theme_classic()+
annotate("text",x=c(50,50,50),y=c(0.7,0.65,0.6),
label=c("p-value: 2.2e-16",
"Adjusted R-squared: 0.9839",
"OD=0.0073*conc-0.038"))
00:00 Data
00:40 scatter plot
02:50 linear regression model
04:40 adding text annotation
06:20 p-value on plot
06:40 R-squared value on plot
07:27 regression equation on plot
08:27 multi-labels in one annotation

Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: