# Equation of Linear Regression

I performed Linear Regression on the data set with two attributes (Salary and YearsExperience) using orange data mining tool.

Salary is a dependent variable and YearsExperience is an independent variable.

Can I find the equation : Salary = b0+YearsExperience*b1.

• Yes you can, try looking for the attributes and get the weights...(atleast that's how it happens in Python) – Aditya Jun 19 '18 at 10:16

Depending on what language you are using you can just print the model. In R it looks like this:

summary(my.model)


The output will look like this, or similar:

##
## Call:
## lm(formula = dist ~ speed.c, data = cars)
##
## Residuals:
##     Min      1Q  Median      3Q     Max
## -29.069  -9.525  -2.272   9.215  43.201
##
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)  42.9800     2.1750  19.761  < 2e-16 ***
## YearsExp     3.9324     0.4155   9.464 1.49e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 15.38 on 48 degrees of freedom
## Multiple R-squared:  0.6511, Adjusted R-squared:  0.6438
## F-statistic: 89.57 on 1 and 48 DF,  p-value: 1.49e-12


Your betas are under the "Estimate Std." Column. Your beta0 is (Intercept) and your beta1 is YearsExp (or whatever your variable is) etc... If you have more than one variable there will be more in this column for you to see.

After you get the betas you can write a function to apply your model to new data like this:

y-hat <- 42.9800 + YearsExp*3.9.324


Model summary copypastad w/ variable name edit from: https://feliperego.github.io/blog/2015/10/23/Interpreting-Model-Output-In-R