Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

Extracting coefficients of a linear model fitted to a ggplot using geom_smooth () in R

$
0
0

@NSS wrote:

Hi,

So, I was doing a quick anaysis on a data set and I plotted a scatter plot between two variables and a regression line using geom_smooth(method="lm") to see the degree of relationship between the two variables. I was wondering if there is a direct way that i can extract the coefficients of that linear model directly out of ggplot.

Here is what I did.

g2<-ggplot(data1,aes(HousePrice,CrimeRate))+geom_point()+geom_smooth(method = "lm")

Thanks

Neeraj

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles