How do I change the start of my trendline to be 0 using ggpmisc stat_poly_line?

133 Views Asked by At

I have a scatter plot in R ggplot2 and I am using ggpmisc's stat_poly_line to draw a trendline and calculate R2, my problem is that due to my data, my trendline starts at a value different from 0 and I want to force the trendline to start at 0 similar to the excel option under trendline.

Any tips for ggpmisc or other pacakges?

my data

  Y       X
0.015   0.014
0.022   
0.094   0.093
0.220   0.322
0.490   0.237
0.970   0.199
0.180   0.119
0.130   0.179
0.230   0.233
0.220   0.091
0.059   0.125
0.065   0.049
0.250   0.145
0.140   0.080
0.210   0.074
0.860   0.592
0.280   
0.032   0.001
0.001   0.001
0.003   0.000
0.130   0.001
0.003   0.000
0.028   0.000
0.006   0.000
0.090   0.000
0.012   0.000
0.067   0.001
0.039   0.000
0.015   0.000
0.001   0.000
0.001   0.000
0.145   0.000

my plot

For reference this is what it looks like in Excel with a set intercept=0

0

There are 0 best solutions below