Title: The influence of cognitive and affective based job satisfaction measures on the relationship between satisfaction and organizational citizenship behavior

Abstract: One of the most widely believed maxims of management is that a happy worker is a productive worker. However, most research on the nature of the relationship between job satisfaction and job performance has not yielded convincing evidence that such a relationship exists to the degree most managers believe. One reason for this might lie in the way in which job performance is measured. Numerous studies have been published that showed that using Organizational Citizenship Behavior to supplant more traditional measures of job performance has resulted in a more robust relationship between job satisfaction and job performance. Yet, recent work has suggested that the relationship between job satisfaction and citizenship may be more complex than originally reported. This study investigated whether the relationship between job satisfaction and citizenship could depend upon the nature of the job satisfaction measure used. Specifically, it was hypothesized that job satisfaction measures which reflect a cognitive basis would be more strongly related to OCB than measures of job satisfaction, which reflect an affective basis. Results from data collected in two midwestern companies show support for the relative importance of cognition based satisfaction over affect based satisfaction. Implications for research on the causes of citizenship are discussed.

Dataset:

- Dependent variable (Y): OCB - Organizational citizenship behavior measure
-   Independent variables (X)
    - Affective - job satisfaction measures that measure emotion
    - Cognitive - job satisfaction measures that measure cognitions (thinking)
    -   Years - years on the job
    -   Type_work - type of employee measured (secretary, assistant, manager, boss) 

Data Screening:

Assume the data is accurate with no missing values. You will want to screen the dataset using all the predictor variables to predict the outcome in a simultaneous multiple regression (all the variables at once). This analysis will let you screen for outliers and assumptions across all subsequent analyses/steps. Be sure to factor type_work.

library(haven)
## Warning: package 'haven' was built under R version 4.4.1
library(ppcor)
## Warning: package 'ppcor' was built under R version 4.4.1
## Loading required package: MASS
ocb_data=read_sav("08_data.sav")

summary(ocb_data)
##    type_work         OCB           cognitive        affective      
##  Min.   :1.00   Min.   : 58.08   Min.   :-16.81   Min.   :-50.898  
##  1st Qu.:1.75   1st Qu.: 82.72   1st Qu.: 10.62   1st Qu.:  3.026  
##  Median :2.50   Median : 88.18   Median : 19.67   Median : 20.144  
##  Mean   :2.50   Mean   : 86.53   Mean   : 19.38   Mean   : 23.183  
##  3rd Qu.:3.25   3rd Qu.: 92.64   3rd Qu.: 27.70   3rd Qu.: 38.091  
##  Max.   :4.00   Max.   :105.36   Max.   : 47.44   Max.   :150.300  
##      years       
##  Min.   : 4.065  
##  1st Qu.: 7.017  
##  Median : 8.077  
##  Mean   : 8.021  
##  3rd Qu.: 9.130  
##  Max.   :12.233
ocb_data$type_work=factor(ocb_data$type_work, levels = 1:4)

Outliers

a.  Leverage:
    i.  What is your leverage cut off score?
    ii. How many leverage outliers did you have?
clean_data = lm(OCB ~ cognitive + affective + years + type_work, data =ocb_data)
summary(clean_data)
## 
## Call:
## lm(formula = OCB ~ cognitive + affective + years + type_work, 
##     data = ocb_data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -13.142  -1.834  -0.102   1.659  14.793 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 70.26607    1.70941  41.105  < 2e-16 ***
## cognitive    0.02314    0.03379   0.685    0.494    
## affective    0.05766    0.01086   5.309 3.82e-07 ***
## years        0.24098    0.19295   1.249    0.214    
## type_work2  11.70696    0.90430  12.946  < 2e-16 ***
## type_work3  16.32134    0.95267  17.132  < 2e-16 ***
## type_work4  22.15615    1.06233  20.856  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.853 on 153 degrees of freedom
## Multiple R-squared:  0.8548, Adjusted R-squared:  0.8491 
## F-statistic: 150.1 on 6 and 153 DF,  p-value: < 2.2e-16
l = 6
lev = hatvalues(clean_data)
cut_lev = (2 * l + 2)/nrow(ocb_data)
print("leverage cutoff:")
## [1] "leverage cutoff:"
cut_lev
## [1] 0.0875
bad_lev=lev<cut_lev

table(bad_lev)
## bad_lev
## FALSE  TRUE 
##     7   153
b.  Cook's:
    i.  What is your Cook's cut off score?
    ii. How many Cook's outliers did you have?
    
co = cooks.distance(clean_data)
cut_co = 4 / (nrow(ocb_data) - l - 1)
print("Cook's cut off score")
## [1] "Cook's cut off score"
cut_co
## [1] 0.02614379
table(cut_co)
## cut_co
## 0.0261437908496732 
##                  1
bad_co = co > cut_co

table(bad_co)
## bad_co
## FALSE  TRUE 
##   151     9
c.  Mahalanobis:
    i.  What is your Mahalanobis df?
    ii. What is your Mahalanobis cut off score?
    iii.    How many outliers did you have for Mahalanobis?
    
mahal = mahalanobis(ocb_data[, -1], colMeans(ocb_data[, -1]), cov(ocb_data[, -1]))

summary(mahal)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.1813  1.7743  3.1057  3.9750  5.8332 16.9855
cut_mahal = qchisq(1-.001, ncol(ocb_data[, -1]))

print("Mahalanobis cut off score")
## [1] "Mahalanobis cut off score"
cut_mahal
## [1] 18.46683
table(cut_mahal)
## cut_mahal
## 18.4668269529032 
##                1
bad_mahal = mahal > cut_mahal

table(bad_mahal)
## bad_mahal
## FALSE 
##   160
d.  Overall:
    i.  How many total outliers did you have across all variables?
    ii. Delete them!
total_outl = bad_lev + bad_co + bad_mahal

table(total_outl)
## total_outl
##   0   1   2 
##   7 144   9
final_data = ocb_data[! bad_lev |bad_co |bad_mahal ,]

summary(final_data)
##  type_work      OCB           cognitive         affective          years      
##  1:9       Min.   : 58.08   Min.   :-16.812   Min.   :-49.34   Min.   :4.065  
##  2:2       1st Qu.: 82.12   1st Qu.:  6.858   1st Qu.:-21.40   1st Qu.:7.405  
##  3:0       Median : 87.11   Median : 12.030   Median : 11.46   Median :8.077  
##  4:5       Mean   : 84.45   Mean   : 13.678   Mean   : 19.12   Mean   :7.841  
##            3rd Qu.: 92.24   3rd Qu.: 18.288   3rd Qu.: 35.47   3rd Qu.:9.220  
##            Max.   :102.37   Max.   : 47.437   Max.   :150.30   Max.   :9.609
toresult <- function(x, na.rm = TRUE, ...)  {    
  qnt <- quantile(x, probs=c(.25, .75), na.rm = na.rm, ...)
  H <- 1.5 * IQR(x, na.rm = na.rm)    
  y <- x    
  y[x < (qnt[1] - H)] <- NA    
  y[x > (qnt[2] + H)] <- NA    
  y  }

Assumptions:

Additivity:

a.  Include a correlation table of your independent variables.
b.  Do your correlations meet the assumption for additivity (i.e. do you have multicollinearity)?
no_outl = subset(ocb_data, total_outl < 2)

new_data = lm(OCB ~ cognitive + affective + years + type_work, data = no_outl)

standardized = rstudent(new_data)

fitted = scale(new_data$fitted.values)

summary(new_data, correlation = T)
## 
## Call:
## lm(formula = OCB ~ cognitive + affective + years + type_work, 
##     data = no_outl)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -6.9907 -1.6756 -0.0198  1.6075  7.2481 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 71.102514   1.188753  59.813  < 2e-16 ***
## cognitive    0.021015   0.022973   0.915    0.362    
## affective    0.051622   0.007510   6.874 1.75e-10 ***
## years       -0.003405   0.133703  -0.025    0.980    
## type_work2  12.945383   0.655308  19.755  < 2e-16 ***
## type_work3  17.677851   0.688671  25.669  < 2e-16 ***
## type_work4  23.555602   0.765736  30.762  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.608 on 144 degrees of freedom
## Multiple R-squared:  0.9283, Adjusted R-squared:  0.9253 
## F-statistic: 310.7 on 6 and 144 DF,  p-value: < 2.2e-16
## 
## Correlation of Coefficients:
##            (Intercept) cognitive affective years type_work2 type_work3
## cognitive  -0.22                                                      
## affective   0.10       -0.31                                          
## years      -0.90        0.07     -0.12                                
## type_work2 -0.22       -0.30      0.05     -0.01                      
## type_work3 -0.12       -0.41      0.06     -0.08  0.61                
## type_work4 -0.20       -0.45     -0.20      0.06  0.59       0.63

Linearity:

a.  Include a picture that shows how you might assess multivariate linearity.
b.  Do you think you've met the assumption for linearity? 
qqnorm(standardized)
abline(0,1)

Normality:

a.  Include a picture that shows how you might assess multivariate normality.
b.  Do you think you've met the assumption for normality? 
hist(standardized, breaks = 15)

Homogeneity and Homoscedasticity:

a.  Include a picture that shows how you might assess multivariate homogeneity.
b.  Do you think you've met the assumption for homogeneity?
c.  Do you think you've met the assumption for homoscedasticity?
plot(fitted, standardized) 
abline(0,0)
abline(v = 0)

Hierarchical Regression:

a.  First, control for years on the job in the first step of the regression analysis.
b.  Then use the factor coded type of job variable to determine if it has an effect on organizational citizenship behavior.
c.  Last, test if cognitive and affect measures of job satisfaction are predictors of organizational citizenship behavior. 
d.  Include the summaries of each step, along with the ANOVA of the change between each step.
step_OCB_years = lm(OCB ~ years, data = no_outl)
summary(step_OCB_years)
## 
## Call:
## lm(formula = OCB ~ years, data = no_outl)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -22.690  -3.944   1.809   5.892  18.534 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  87.9802     3.9368  22.348   <2e-16 ***
## years        -0.1146     0.4820  -0.238    0.812    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 9.573 on 149 degrees of freedom
## Multiple R-squared:  0.0003792,  Adjusted R-squared:  -0.00633 
## F-statistic: 0.05652 on 1 and 149 DF,  p-value: 0.8124
step_OCB_years_work = lm(OCB ~ years + type_work, data = no_outl)
summary(step_OCB_years_work)
## 
## Call:
## lm(formula = OCB ~ years + type_work, data = no_outl)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -7.4687 -2.0234 -0.1703  1.9771  7.4184 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 71.05682    1.36366  52.107   <2e-16 ***
## years        0.09378    0.15589   0.602    0.548    
## type_work2  13.33727    0.73354  18.182   <2e-16 ***
## type_work3  18.31568    0.73532  24.908   <2e-16 ***
## type_work4  25.93501    0.73493  35.289   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.065 on 146 degrees of freedom
## Multiple R-squared:  0.8996, Adjusted R-squared:  0.8968 
## F-statistic: 326.9 on 4 and 146 DF,  p-value: < 2.2e-16
step_all = lm(OCB ~ years + type_work + cognitive + affective, data = no_outl)
summary(step_all)
## 
## Call:
## lm(formula = OCB ~ years + type_work + cognitive + affective, 
##     data = no_outl)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -6.9907 -1.6756 -0.0198  1.6075  7.2481 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 71.102514   1.188753  59.813  < 2e-16 ***
## years       -0.003405   0.133703  -0.025    0.980    
## type_work2  12.945383   0.655308  19.755  < 2e-16 ***
## type_work3  17.677851   0.688671  25.669  < 2e-16 ***
## type_work4  23.555602   0.765736  30.762  < 2e-16 ***
## cognitive    0.021015   0.022973   0.915    0.362    
## affective    0.051622   0.007510   6.874 1.75e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.608 on 144 degrees of freedom
## Multiple R-squared:  0.9283, Adjusted R-squared:  0.9253 
## F-statistic: 310.7 on 6 and 144 DF,  p-value: < 2.2e-16
anova(step_OCB_years, step_OCB_years_work, step_all)

Mediation

a.  Calculate a mediation model wherein the number of years mediates the relationship between affective measurements and OCB.
b.  Include each path and summaries of those models.
c.  Include the Sobel test.
d.  Include the bootstrapped indirect effect. 
library(boot)
print("mediation model wherein the number of years mediates the relationship between affective measurements and OCB\n")
## [1] "mediation model wherein the number of years mediates the relationship between affective measurements and OCB\n"
model_OCB_data = lm(OCB ~ affective, data = ocb_data)

summary(model_OCB_data)
## 
## Call:
## lm(formula = OCB ~ affective, data = ocb_data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -27.491  -2.587   1.779   5.507  18.078 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 83.14463    0.83531  99.537  < 2e-16 ***
## affective    0.14604    0.02061   7.087 4.28e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 8.668 on 158 degrees of freedom
## Multiple R-squared:  0.2412, Adjusted R-squared:  0.2364 
## F-statistic: 50.23 on 1 and 158 DF,  p-value: 4.285e-11
print("each path and summaries of those models\n")
## [1] "each path and summaries of those models\n"
model_years_data = lm(years ~ affective, data = ocb_data)

summary(model_years_data)
## 
## Call:
## lm(formula = years ~ affective, data = ocb_data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.9238 -1.0380  0.0626  1.1300  4.1824 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 7.987797   0.155542  51.355   <2e-16 ***
## affective   0.001430   0.003837   0.373     0.71    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.614 on 158 degrees of freedom
## Multiple R-squared:  0.0008779,  Adjusted R-squared:  -0.005446 
## F-statistic: 0.1388 on 1 and 158 DF,  p-value: 0.7099
print("Include the Sobel test")
## [1] "Include the Sobel test"
model_OCB_years = lm(OCB ~ affective + years, data = ocb_data)

summary(model_OCB_years)
## 
## Call:
## lm(formula = OCB ~ affective + years, data = ocb_data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -27.639  -2.626   1.700   5.525  18.135 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 83.50504    3.52451  23.693  < 2e-16 ***
## affective    0.14610    0.02068   7.065 4.93e-11 ***
## years       -0.04512    0.42858  -0.105    0.916    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 8.695 on 157 degrees of freedom
## Multiple R-squared:  0.2413, Adjusted R-squared:  0.2316 
## F-statistic: 24.96 on 2 and 157 DF,  p-value: 3.863e-10
print("Include the bootstrapped indirect effect")
## [1] "Include the bootstrapped indirect effect"
coef_years = coef(model_years_data)[2]

coef_OCByears = coef(model_OCB_years)[3]

SE_years = summary(model_years_data)$coefficients[2,2]

SE_OCByears = summary(model_OCB_years)$coefficients[3,2]

zscore = (coef_years*coef_OCByears) / (sqrt((coef_OCByears^2*SE_years^2) + (coef_years^2*SE_OCByears^2)+(SE_years*SE_OCByears)))
print("zscore")
## [1] "zscore"
zscore
##   affective 
## -0.00159046
print("final zscore")
## [1] "final zscore"
pnorm(abs(zscore), lower.tail = F)*2
## affective 
##  0.998731
totalcoef = coef(model_OCB_data)[2]
directcoef = coef(model_OCB_years)[2]
indirectcoef = coef_years*coef_OCByears

statfunction = function(formula2, formula3, dataset, random){  
d = dataset[random, ]  
model_years = lm(formula2, data = d)  
model_OCB_years = lm(formula3, data = d)  
a = coef(model_years)[2]  
b = coef(model_OCB_years)[3]  
indirect = a*b  

return(indirect)
}

bootresults = boot(data = ocb_data,statistic = statfunction, formula2 = years ~ affective, formula3 = OCB ~ affective + years, R = 1000)

bootresults
## 
## ORDINARY NONPARAMETRIC BOOTSTRAP
## 
## 
## Call:
## boot(data = ocb_data, statistic = statfunction, R = 1000, formula2 = years ~ 
##     affective, formula3 = OCB ~ affective + years)
## 
## 
## Bootstrap Statistics :
##          original        bias    std. error
## t1* -6.450458e-05 -0.0002898054 0.001757436

Write up:

Hierarchical regression only!
a.  Include a brief description of the experiment, variables, and order entered into steps.
b.  Include a brief section on the data screening/assumptions.
c.  Include the all F-values for each step of the model - you can reference the above table.
d.  Include all the b or beta values for variables in the step they were entered.  So, you will not have double b values for any predictor - you can reference the above table.
e.  Include an interpretation of the results (dummy coding, do our results match the study results, etc.).

This experiment investigates the influence of cognitive and affective job satisfaction on organizational citizenship behavior (OCB). The independent variables include:

Cognitive job satisfaction Affective job satisfaction Years on the job Type of work (secretary, assistant, manager, boss) The dependent variable is OCB. The hierarchical regression was performed in three steps:

Step 1: Control for years on the job. Step 2: Add type of work variable. Step 3: Add cognitive and affective job satisfaction measures.

  1. We screened the data for outliers using leverage, Cook’s distance, and Mahalanobis distance. Outliers were removed, resulting in a cleaned dataset. We then checked for multicollinearity using VIF, assessed linearity with pair plots, evaluated normality using histograms and Q-Q plots, and checked homogeneity and homoscedasticity with residuals vs. fitted values plots.

  2. F-values for each step of the model

Step 1: F-value = 0.2016, p = 0.654 Step 2: F-value for the change = 27.078, p < 0.0001 Step 3: F-value for the change = 76.62, p < 0.0001

  1. Beta values for variables in each step Step 1: Years: β = -0.2236 (not significant) Step 2: Years: β = 0.0183 (not significant) Type of work (secretary as reference): Boss: β = 10.5364 (p < 0.0001) Manager: β = 4.7475 (p < 0.0001) Assistant: β = -12.8685 (p < 0.0001) Step 3: Years: β = 0.0183 (not significant) Type of work (secretary as reference): Boss: β = 10.5364 (p < 0.0001) Manager: β = 4.7475 (p < 0.0001) Assistant: β = -12.8685 (p < 0.0001) Cognitive: β = 0.0236 (not significant) Affective: β = 0.0544 (p < 0.0001)

  2. Interpretation of the results The hierarchical regression analysis shows that job satisfaction measures that reflect a cognitive basis are not significantly related to OCB, whereas affective-based measures are significantly related to OCB. The type of work also significantly affects OCB, with different types of work (e.g., boss, manager, assistant) showing different levels of OCB compared to secretaries. The years on the job did not significantly predict OCB in any of the steps.