I have this graph, from package car
, figure 1:
The code is:
scatterplot(istat_22 ~ vpa_cnr_2,grid=F, smooth=F)
But if i want the p-value of the regression line, and r and r^2,how i can obtained it and plot them on the graph?
Substancially i would the equation of the straight line and the value of the statistic.
Another question is, why if I plot with lm
, like:
plot(vpa_cnr_2,istat_22)
abline(lm(vpa_cnr_2 ~ istat_22),col="red")
the straight line is not the same of figure 1 (see the figure 2)?
Yes i know, it depend from intercept, but R don't find the best fit with function lm
?