title: R-squared for observed and modeled relative to 1:1 line in R
body: <p>This question may sound a little bit weird. I want to know how can I report the R-sqaured value in R compared to 1:1 line. For example I want to compare the observed and modeled values. In the ideal case, it should be a straight line passing through an origin at an angle of 45 degrees. </p>
  
  <p>For example I have a data which can be found on <a href="https://www.dropbox.com/s/71u2vsgt7p9k5cl/correlationcsv" rel="nofollow noreferrer">https://www.dropbox.com/s/71u2vsgt7p9k5cl/correlationcsv</a></p>
  
  <p>The code I wrote is as follows:</p>
  
  <pre><code>&gt; corsen&lt;- read.table("Sensitivity Runs/correlationcsv",sep=",",header=T)
  &gt; linsensitivity &lt;- lm(data=corsen,sensitivity~0+observed)
  &gt; summary(linsensitivity)
  
  Call:
  lm(formula = sensitivity ~ 0 + observed, data = corsen)
  
  Residuals:
       Min       1Q   Median       3Q      Max 
  -0.37615 -0.03376  0.00515  0.04155  0.27213 
  
  Coefficients:
           Estimate Std. Error t value Pr(&gt;|t|)    
  observed 0.833660   0.001849   450.8   &lt;2e-16 ***
  ---
  Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
  
  Residual standard error: 0.05882 on 2988 degrees of freedom
  Multiple R-squared: 0.9855, Adjusted R-squared: 0.9855 
  F-statistic: 2.032e+05 on 1 and 2988 DF,  p-value: &lt; 2.2e-16 
  </code></pre>
  
  <p>The plot looks like following:</p>
  
  <pre><code>ggplot(corsen,aes(observed,sensitivity))+geom_point()+geom_smooth(method="lm",aes(color="red"))+
    ylab(" Modeled (m)")+xlab("Observed (m)")+
    geom_line(data=oneline,aes(x=onelinex,y=oneliney,color="blue"))+ 
    scale_color_manual("",values=c("red","blue"),label=c("1:1 line","Regression Line"))+theme_bw()+theme(legend.position="top")+
    coord_cartesian(xlim=c(-0.2,2),ylim=c(-0.2,2))
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/iWHzu.png" alt="Correlation plot"></p>
  
  <p>My question is that if we look closely the data are off from the 1:1 line. How can I find the R-squared relative to the 1:1 line ? Right now the linear model I used is regardless of the line specified. It is purely based on the data provided. </p>