2025-11-02

Background

For this project im using the data set of attitude in R. In the dataset it consists of 30 different observations of employees along with the 7 different variables each. They measure aspects of the workplace perception that are:

  • Overall Rating: Overall rating of company
  • Complaints: How the complaints are handled
  • Privileges: Special privileges at work
  • Learning: Opportunities for learning
  • Raises: Fairness when it comes to giving raises
  • Critical: Critical attitudes of management
  • Advance: Opportunities for advancing

Problem, Research Question and Objective

  • Problem: Employees satisfaction and perception of the workplace can be influenced by several factors like practices in management, space for advancement and much more. Learning these relationships can help places of work improve workplace satisfaction.
  • Research Question: Which factors (Complaints, Learning, Raises, Privileges, Critical management, and Opportunities for Advancement) are most strongly associated with employees overall rating of their company?
  • Objective: My goal is to look into which factors are more strongly linked with employees overall rating of the company and specifically looking into segments of factors I listed above.

Data Loading/Wrangling

# Load the built-in attitude dataset
data("attitude")
# Preview of the first few rows
head(attitude,2)
##   rating complaints privileges learning raises critical advance
## 1     43         51         30       39     61       92      45
## 2     63         64         51       54     63       73      47
# Summary of dataset first few rows
summary(attitude[,1:2])
##      rating        complaints  
##  Min.   :40.00   Min.   :37.0  
##  1st Qu.:58.75   1st Qu.:58.5  
##  Median :65.50   Median :65.0  
##  Mean   :64.63   Mean   :66.6  
##  3rd Qu.:71.75   3rd Qu.:77.0  
##  Max.   :85.00   Max.   :90.0
# Check the structure of the dataset first few roads
str(attitude[1:2,])
## 'data.frame':    2 obs. of  7 variables:
##  $ rating    : num  43 63
##  $ complaints: num  51 64
##  $ privileges: num  30 51
##  $ learning  : num  39 54
##  $ raises    : num  61 63
##  $ critical  : num  92 73
##  $ advance   : num  45 47

Data Cleaning

# Check missing values in dataset
colSums(is.na(attitude))
##     rating complaints privileges   learning     raises   critical    advance 
##          0          0          0          0          0          0          0
# Check for duplicates 
sum(duplicated(attitude))
## [1] 0

EDA Exploratory Data Analysis

#Summary of statistics in all variables
data("attitude") 
summary(attitude) 
##      rating        complaints     privileges       learning         raises     
##  Min.   :40.00   Min.   :37.0   Min.   :30.00   Min.   :34.00   Min.   :43.00  
##  1st Qu.:58.75   1st Qu.:58.5   1st Qu.:45.00   1st Qu.:47.00   1st Qu.:58.25  
##  Median :65.50   Median :65.0   Median :51.50   Median :56.50   Median :63.50  
##  Mean   :64.63   Mean   :66.6   Mean   :53.13   Mean   :56.37   Mean   :64.63  
##  3rd Qu.:71.75   3rd Qu.:77.0   3rd Qu.:62.50   3rd Qu.:66.75   3rd Qu.:71.00  
##  Max.   :85.00   Max.   :90.0   Max.   :83.00   Max.   :75.00   Max.   :88.00  
##     critical        advance     
##  Min.   :49.00   Min.   :25.00  
##  1st Qu.:69.25   1st Qu.:35.00  
##  Median :77.50   Median :41.00  
##  Mean   :74.77   Mean   :42.93  
##  3rd Qu.:80.00   3rd Qu.:47.75  
##  Max.   :92.00   Max.   :72.00
#Correlation matrix 
cor(attitude) 
##               rating complaints privileges  learning    raises  critical
## rating     1.0000000  0.8254176  0.4261169 0.6236782 0.5901390 0.1564392
## complaints 0.8254176  1.0000000  0.5582882 0.5967358 0.6691975 0.1877143
## privileges 0.4261169  0.5582882  1.0000000 0.4933310 0.4454779 0.1472331
## learning   0.6236782  0.5967358  0.4933310 1.0000000 0.6403144 0.1159652
## raises     0.5901390  0.6691975  0.4454779 0.6403144 1.0000000 0.3768830
## critical   0.1564392  0.1877143  0.1472331 0.1159652 0.3768830 1.0000000
## advance    0.1550863  0.2245796  0.3432934 0.5316198 0.5741862 0.2833432
##              advance
## rating     0.1550863
## complaints 0.2245796
## privileges 0.3432934
## learning   0.5316198
## raises     0.5741862
## critical   0.2833432
## advance    1.0000000
#Scatter plot example 
x <- as.numeric(attitude$Complaints) 
y <- as.numeric(attitude$Rating)

Linear Regression Analysis

## 
## Call:
## lm(formula = rating ~ complaints, data = attitude)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -12.8799  -5.9905   0.1783   6.2978   9.6294 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 14.37632    6.61999   2.172   0.0385 *  
## complaints   0.75461    0.09753   7.737 1.99e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 6.993 on 28 degrees of freedom
## Multiple R-squared:  0.6813, Adjusted R-squared:  0.6699 
## F-statistic: 59.86 on 1 and 28 DF,  p-value: 1.988e-08

Data Visualization

  • Histogram of Ratings Scatter plot: Complaints vs Rating
## 'data.frame':    30 obs. of  7 variables:
##  $ rating    : num  43 63 71 61 81 43 58 71 72 67 ...
##  $ complaints: num  51 64 70 63 78 55 67 75 82 61 ...
##  $ privileges: num  30 51 68 45 56 49 42 50 72 45 ...
##  $ learning  : num  39 54 69 47 66 44 56 55 67 47 ...
##  $ raises    : num  61 63 76 54 71 54 66 70 71 62 ...
##  $ critical  : num  92 73 86 84 83 49 68 66 83 80 ...
##  $ advance   : num  45 47 48 35 47 34 35 41 31 41 ...

References

  • Dataset: attitude — built-in dataset from R’s datasets package
  • R Core Team (2024). R: A language and environment for statistical computing.
  • Visualization and analysis performed using base R functions.
  • Presentation created with RMarkdown (ioslides).

 

##Conclusion - The analysis explored relationships between employee ratings, complaints, and other performance-related factors using the built-in attitude dataset.

  • From the scatter plot, we observed that higher levels of complaints generally correspond to lower employee ratings, suggesting a negative relationship.

  • The correlation and summary statistics support this trend — employee satisfaction and perceptions of management are linked.

  • The simple regression analysis (or EDA results) help demonstrate how basic data analysis can highlight factors affecting employee attitudes.

  • Future work could include more advanced methods (e.g., clustering or multiple regression) using richer HR datasets.