Introduction

  • Simple linear regression is a statistical method that allows us to study the relationship between two continuous variables.
  • In this project, we aim to analyze the relationship between Years of Experience, Education Level, and Salary.
  • We will perform exploratory data analysis and apply statistical procedures to answer our questions.

Data Description

  • Dataset: Simulated data relating Years of Experience and Education Level to Salary.
  • Variables:
    • experience: Number of years of work experience (independent variable).
    • education: Education level in years (independent variable).
    • salary: Annual salary in dollars (dependent variable).
  • The dataset consists of 10 observations.

Summary

summary(data)
##    experience      education        salary     
##  Min.   : 1.00   Min.   :12.0   Min.   :29395  
##  1st Qu.: 3.25   1st Qu.:12.5   1st Qu.:52102  
##  Median : 5.50   Median :15.0   Median :58968  
##  Mean   : 5.50   Mean   :15.0   Mean   :58246  
##  3rd Qu.: 7.75   3rd Qu.:16.0   3rd Qu.:69240  
##  Max.   :10.00   Max.   :20.0   Max.   :77151

Interpretation: Experience ranges from 1 to 10 years. Education levels range from 12 to 20 years. Salary ranges from approximately $30,000 to $95,000. The average salary is around $77,000.

Salary vs. Experience

Salary vs. Education

Observations: There is a positive relationship between salary and both experience and education level. As experience and education increase, salary tends to increase.

The Linear Regression Model

We will fit a multiple linear regression model to predict salary based on experience and education level. The model is:

\[ \hat{salary} = \beta_0 + \beta_1 \times experience + \beta_2 \times education \]

where:
- \(\beta_0\): Intercept
- \(\beta_1\): Coefficient for experience
- \(\beta_2\): Coefficient for education

Model Summary

## 
## Call:
## lm(formula = salary ~ experience + education, data = data)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
##  -9881  -6068  -1243   2023  17765 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)  
## (Intercept)    51520      22874   2.252   0.0590 .
## experience      5184       1742   2.975   0.0207 *
## education      -1452       1948  -0.745   0.4803  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 10050 on 7 degrees of freedom
## Multiple R-squared:  0.6793, Adjusted R-squared:  0.5877 
## F-statistic: 7.413 on 2 and 7 DF,  p-value: 0.01868

3D Scatter Plot with Regression Plane

Conclusion

  • Key Findings:
    • Experience and education both positively impact salary.
    • The model indicates that increasing experience or education leads to higher predicted salary.
  • Model Insights:
    • Both predictors are statistically significant in our model.
    • The 3D visualization illustrates how these factors interact to influence salary.
  • Limitations:
    • Small, simulated dataset.
    • Real-world factors like industry, job title, and location are not included.