- 581
- 0
- 约1.09千字
- 约 1页
- 2021-02-14 发布于山西
- 举报
六六 DATA
2
R 语言作图并在图上显示R 和p 值
#作图并在图上显示R^2 和p 值:
plotAnnotatedScatter - function(x , y , pointCol=rgb(0,0,0,0.7),
legendPos=topleft, legendCex=1, ...
){
# Generate a linear model summary
fit - lm(y ~ x)
fitSum - summary(fit)
r2 - fitSum$r.squared
pVal - fitSum$coefficients[2,4]
# Format the legend for r and p values
rp - vector(expression,2)
rp[1] - substitute(expression (italic(R)^2 == valueA),
li
原创力文档

文档评论(0)