You are on page 1of 5

> setwd("C:/Users/Rakesh/Desktop/DAT-Rakesh.

M/19101")

> getwd()

[1] "C:/Users/Rakesh/Desktop/DAT-Rakesh.M/19101"

> install.packages("readxl")

package ‘readxl’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in

C:\Users\Rakesh\AppData\Local\Temp\RtmpKwqkq2\downloaded_packages

> library(readxl)

> install.packages("psych")

package ‘psych’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in

C:\Users\Rakesh\AppData\Local\Temp\RtmpKwqkq2\downloaded_packages

> library(psych)

> install.packages("car")

package ‘car’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in

C:\Users\Rakesh\AppData\Local\Temp\RtmpKwqkq2\downloaded_packages
> library(car)

> install.packages("lm.beta")

package ‘lm.beta’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in

C:\Users\Rakesh\AppData\Local\Temp\RtmpKwqkq2\downloaded_packages

> library(lm.beta)
> install.packages("lmtest")

package ‘lmtest’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in

C:\Users\Rakesh\AppData\Local\Temp\RtmpKwqkq2\downloaded_packages

> library(lmtest)

> Empl_sat=read_excel(file.choose())

> attach(Empl_sat)

> fix(Empl_sat)

> View(Empl_sat)
> names(Empl_sat)

[1] "ID"
[2] "Vintage"
[3] "Gender"
[4] "Business Group"
[5] "How Satisfied are you with your job ?"
[6] "How well is your skill getting used ?"
[7] "Satisfaction with Training Provided"
[8] "Satisfaction with consistency of Policies"
[9] "Satisfaction with Abundance of opportunities"
[10] "Satisfaction with Pay and compensation"
[11] "Given a chance would you leave for similar pay?"
[12] "Engagement Index"
[13] "Clarity of goals explained by manager?"
[14] "Feedback effectiveness from manager?"
[15] "Manager - taking and accepting accountability of mistakes"
[16] "Manager treating everyone equitably"
[17] "Manager Index"
[18] "Organization Communication of Core values"
[19] "Organization policies consistent with senior management actions"
[20] "Organization demonstrating integriry in business transactions"
[21] "Clarity on organization Vision, Objective and Goals"
[22] "Organization Index"
[23] "Safety in workplace"
[24] "Having resources to do my job well"
[25] "I have all the information I need to do my job effectively"
[26] "Workplace Index"
[27] "We work to attract, develop, and retain people with diverse
backgrounds."
[28] "People who challenge the status quo are valued."
[29] "I can disagree with my supervisor without fear of getting in
trouble."
[30] "Clarity on how my team's goal help achieve organization goals"
[31] "Team Index"
[32] "Comments - Areas of Improvement"
[33] "Comments - What's working well"
[34] "Sample Weight"

> str(Empl_sat)

'data.frame': 404 obs. of 34 variables:


$ ID
: num 1 2 3 4 5 6 7 8 9 10 ...
$ Vintage
: num 3 3 5 4 2 5 5 3 3 4 ...
$ Gender
: chr "FEMALE" "MALE" "FEMALE" "MALE" ...
$ Business Group
: num 4 4 3 5 3 3 3 3 2 4 ...
$ How Satisfied are you with your job ?
: num 3 2 5 4 4 4 3 5 4 3 ...
$ How well is your skill getting used ?
: num 4 4 5 4 5 3 3 4 3 4 ...
$ Satisfaction with Training Provided
: num 5 4 5 3 3 1 2 5 3 3 ...
$ Satisfaction with consistency of Policies
: num 4 4 1 5 1 4 4 4 4 4 ...
$ Satisfaction with Abundance of opportunities
: num 4 5 5 4 3 1 3 3 3 3 ...
$ Satisfaction with Pay and compensation
: num 4 4 5 4 5 3 3 4 3 4 ...
$ Given a chance would you leave for similar pay?
: num 5 2 5 4 4 2 4 5 4 4 ...
$ Engagement Index
: num 3.96 2.66 4.76 4 3.82 2.92 3.3 4.7 3.76 3.48 ...
$ Clarity of goals explained by manager?
: num 2 2 2 4 2 3 3 5 2 2 ...
$ Feedback effectiveness from manager?
: num 2 1 3 1 3 3 2 2 2 1 ...
$ Manager - taking and accepting accountability of mistakes
: num 3 2 4 4 2 3 2 2 2 1 ...
$ Manager treating everyone equitably
: num 3 3 5 2 4 3 3 3 2 2 ...
$ Manager Index
: num 2.5 2 3.5 2.75 2.75 3 2.5 3 2 1.5 ...
$ Organization Communication of Core values
: num 4 3 3 3 4 3 2 3 3 4 ...
$ Organization policies consistent with senior management actions
: num 5 4 5 3 5 1 2 3 2 3 ...
$ Organization demonstrating integriry in business transactions
: num 4 1 3 4 5 3 1 4 1 4 ...
$ Clarity on organization Vision, Objective and Goals
: num 3 4 1 1 1 4 1 4 1 2 ...
$ Organization Index
: num 4 3 3 2.75 3.75 2.75 1.5 3.5 1.75 3.25 ...
$ Safety in workplace
: num 1 2 5 1 3 5 3 5 4 3 ...
$ Having resources to do my job well
: num 3 2 5 1 3 5 3 5 4 2 ...
$ I have all the information I need to do my job effectively
: num 2 1 4 1 1 1 2 5 4 2 ...
$ Workplace Index
: num 2 1.67 4.67 1 2.33 3.67 2.67 5 4 2.33 ...
$ We work to attract, develop, and retain people with diverse
backgrounds.: num 5 2 4 4 5 2 1 5 5 5 ...
$ People who challenge the status quo are valued.
: num 1 3 2 2 2 3 3 3 3 5 ...
$ I can disagree with my supervisor without fear of getting in trouble.
: num 2 5 4 3 5 4 4 5 2 5 ...
$ Clarity on how my team's goal help achieve organization goals
: num 1 1 5 3 3 4 3 1 4 2 ...
$ Team Index
: num 2.25 2.75 3.75 3 3.75 3.25 2.75 3.5 3.5 4.25 ...
$ Comments - Areas of Improvement
: chr "Compensation should be improved" "Slow growth and career
opportunities. Not too many resources to do my job well" NA "It's a big
company and can be hard to stand out. Lots and lots of process. Being
overworked is common. Cost cut"| __truncated__ ...
$ Comments - What's working well
: chr NA NA "Integrity in every business decision" "Work Life Balance .
Great employee friendly policies" ...
$ Sample Weight
: num 1 1 1 1 0.9 1 1 1.1 1 1.1 ...

> EI_lm=lm(`Engagement Index`~ `How Satisfied are you with your job ?
`+`How well is your skill getting used ?`+`Satisfaction with Training
Provided`+`Satisfaction with consistency of Policies`+`Satisfaction with
Abundance of opportunities`+`Satisfaction with Pay and
compensation`+`Given a chance would you leave for similar pay?`,
data=Empl_sat)

> summary(EI_lm)

Call:
lm(formula = `Engagement Index` ~ `How Satisfied are you with your job ?`
+
`How well is your skill getting used ?` + `Satisfaction with Training
Provided` +
`Satisfaction with consistency of Policies` + `Satisfaction with
Abundance of opportunities` +
`Satisfaction with Pay and compensation` + `Given a chance would you
leave for similar pay?`,
data = Empl_sat)

Residuals:
Min 1Q Median 3Q Max
-2.109e-13 -3.630e-16 5.640e-16 1.471e-15 5.183e-15
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.285e-14 2.818e-15 -4.561e+00 6.85e-06 ***
`How Satisfied are you with your job ?` 4.000e-01 6.143e-16 6.512e+14 < 2e-16 ***
`How well is your skill getting used ?` 6.000e-02 6.379e-15 9.406e+12 < 2e-16 ***
`Satisfaction with Training Provided` 6.000e-02 6.342e-16 9.460e+13 < 2e-16 ***
`Satisfaction with consistency of Policies` 6.000e-02 5.222e-16 1.149e+14 < 2e-16 ***
`Satisfaction with Abundance of opportunities` 6.000e-02 5.632e-16 1.065e+14 < 2e-16 ***
`Satisfaction with Pay and compensation` 6.000e-02 6.411e-15 9.359e+12 < 2e-16 ***
`Given a chance would you leave for similar pay?` 3.000e-01 5.335e-16 5.623e+14 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.088e-14 on 388 degrees of freedom


(8 observations deleted due to missingness)
Multiple R-squared: 1, Adjusted R-squared: 1
F-statistic: 3.8e+29 on 7 and 388 DF, p-value: < 2.2e-16

> # Testing the Assumptions of the Model

> #1. Average error is zero

> mean(EI_lm$residuals)
[1] -1.031181e-29

> #2. Errors have constant variance

> bptest(EI_lm)

studentized Breusch-Pagan test

data: EI_lm

BP = 5.3896, df = 7, p-value = 0.6125

> #3. Errors are uncorrelated

> durbinWatsonTest(EI_lm)

lag Autocorrelation D-W Statistic p-value


1 0.1095115 0.8115828 0
Alternative hypothesis: rho != 0

> #4. Errors are normally distributed


> shapiro.test(EI_lm$residuals)

Shapiro-Wilk normality test

data: EI_lm$residuals

W = 0.08614, p-value < 2.2e-16

> # The assumption of normality is not satisfied

> #5. All the regressors are independent

> vif(EI_lm)
`
`How Satisfied are you with your job ?`
1.611577

`How well is your skill getting used ?`


234.838590

`Satisfaction with Training Provided`


2.076297

`Satisfaction with consistency of Policies`


1.003354
`Satisfaction with Abundance of opportunities`
1.850364

`Satisfaction with Pay and compensation`


236.922548

`Given a chance would you leave for similar pay?`


1.443709

You might also like