title: including regression coefficient and pvalue in the ggplot2
body: <p>I did linear regression analysis between the response variable(y) and
  predictor variables in the surgical data set considering <strong>pindex</strong> as a confounding variable.
  I aim to plot the response variable(y) against the experimentally determined values of the predictor variables and to this end, I am Successful. However, could not able to indicate the estimated regression and p-value in the ggplot2.
  In the code below, trying to do the analysis and the plot.
  It would be much appreciated if someone could show me how to indicate the estimated regression and p-values inside the ggplot2.</p>
  <pre><code>library(olsrr)
  library(tidyverse)
  library(reshape2)
  data(surgical)
  
  ## Regression 
  pre1 &lt;-setdiff(names(surgical), c(&quot;y&quot;, &quot;pindex&quot;))
  mod_dres&lt;-NULL
  for (j in pre1) {
    model  &lt;- lm(y  ~  pindex + get(j), data = surgical)
    bmodel &lt;- broom::tidy(model)
    bmodel$term[3]&lt;-j
    bmodel&lt;-bmodel[3,]
    mod_dres&lt;-rbind(mod_dres,bmodel)
  }
  mod_dres
  
  ## Matching the significant variables with the orginal data and reshaping  
  pre1.plot = melt(surgical[,-c(2)], id.vars='y') %&gt;% 
    dplyr::filter(variable %in% mod_dres$term) 
  
  ## plot the predictors varaibles 
  ggplot(pre1.plot) +
    geom_jitter(aes(value,y, colour=variable), 
                colour=&quot;darkorange&quot;, size = 3) + 
    geom_smooth(aes(value,y, colour=variable), 
                method=lm, se=FALSE, colour=&quot;darkorange&quot;) +
    theme_minimal() +
    theme(axis.title = element_text(size = 16,face=&quot;bold&quot;, colour = &quot;black&quot;),
          axis.text = element_text(size = 16,face=&quot;bold&quot;, colour = &quot;black&quot;),
          axis.line = element_line(colour='black'),
          axis.ticks = element_line(colour='black'),
          plot.title = element_text(hjust = 0.5,size=18,face=&quot;bold&quot;),
          legend.position = &quot;bottom&quot;,
          legend.title = element_text(color = &quot;Black&quot;, size = 9, face = &quot;bold&quot;),
          legend.text=element_text(color = &quot;Black&quot;, size = 9, face = &quot;bold&quot;),
          strip.text.x = element_text(size = 16,face=&quot;bold&quot;, colour = &quot;black&quot;)) +
    labs(x = &quot;value&quot;,title = &quot; &quot;) +
    facet_wrap(~variable, scales=&quot;free_x&quot;,nrow = 2, ncol = 4) + 
    theme(panel.background = element_rect(fill = &quot;white&quot;, colour = &quot;black&quot;),
          strip.background = element_rect(fill = &quot;white&quot;, colour = &quot;black&quot;),
          legend.key = element_blank(),
          legend.title = element_blank())
  </code></pre>
  <p>Thank you!</p>