การวิเคราะห์ความซ้ำซ้อน (Redundancy Analysis; RDA)

อ่านข้อมูลด้วยคำสั่ง read.table แล้วใส่ไฟล์ที่ต้องการอ่านลงไป ในที่นี้คือ leadership.csv

dat <- read.table("leadership.csv", sep=",", header=TRUE)

ข้อมูลนี้เป็นข้อมูลจากลูกน้องจำนวน 201 คน ประเมินหัวหน้าตนเองด้วยมาตร Multifactor Leadership Questionnaire (MLQ) โดยคะแนนจากมาตรนี้จะแบ่งออกเป็นลักษณะของผู้นำ 9 ด้าน ซึ่งจะใช้เป็นตัวแปรทำนาย และตัวแปรผลลัพธ์จะเป็นการประเมินตนเองของลูกน้อง โดยจะประเมินเรื่องประสิทธิภาพในการทำงาน การใช้พยายามพิเศษในการทำงาน และความพึงพอใจในงาน ดูค่าสถิติพื้นฐานของข้อมูลได้โดยคำสั่ง describe จาก psych package

library(psych)
describe(dat)
##                         vars   n   mean    sd median trimmed   mad min max
## id                         1 201 101.00 58.17    101  101.00 74.13   1 201
## idealattributed            2 201  15.08  2.73     15   15.24  2.97   4  20
## idealbehavior              3 201  15.01  2.61     15   15.08  2.97   8  20
## individualconsideration    4 201  15.18  2.66     15   15.33  2.97   7  20
## inspiremotive              5 201  15.61  2.73     16   15.78  2.97   7  20
## intelstimulation           6 201  15.82  2.48     16   15.94  2.97   4  20
## contingentreward           7 201  16.34  2.28     16   16.46  2.97   9  20
## managebyexceptactive       8 201  15.14  2.53     15   15.30  2.97   8  20
## managebyexceptpassive      9 201   9.42  2.49      9    9.40  2.97   4  16
## laissezfaire              10 201   8.89  2.39      9    8.89  2.97   4  18
## effectiveness             11 201  14.95  2.78     15   15.07  2.97   6  20
## extraeffort               12 201  11.79  2.09     12   11.86  1.48   4  15
## satisfaction              13 201   8.06  1.54      8    8.19  1.48   2  10
##                         range  skew kurtosis   se
## id                        200  0.00    -1.22 4.10
## idealattributed            16 -0.69     0.88 0.19
## idealbehavior              12 -0.30    -0.35 0.18
## individualconsideration    13 -0.50    -0.04 0.19
## inspiremotive              13 -0.67     0.27 0.19
## intelstimulation           16 -0.73     1.52 0.18
## contingentreward           11 -0.47    -0.14 0.16
## managebyexceptactive       12 -0.49    -0.19 0.18
## managebyexceptpassive      12  0.07    -0.53 0.18
## laissezfaire               14  0.14     0.26 0.17
## effectiveness              14 -0.41    -0.11 0.20
## extraeffort                11 -0.45     0.18 0.15
## satisfaction                8 -0.92     1.37 0.11

ในการทำ RDA จะใช้คำสั่ง rda ในแพ๊คเกจ vegan แต่การวิเคราะห์ RDA จะเกี่ยวข้องกับตัวแปรจำนวนมาก เพื่อให้ง่ายต่อการวิเคราะห์ ให้สร้างข้อมูลใหม่ ที่ข้อมูลหนึ่งมีเฉพาะตัวแปรทำนาย และอีกข้อมูลหนึ่งมีเฉพาะตัวแปรผลลัพธ์

predictors <- dat[,c("idealattributed", "idealbehavior", 
                     "individualconsideration", "inspiremotive", 
                     "intelstimulation", "contingentreward", 
                     "managebyexceptactive", "managebyexceptpassive", 
                     "laissezfaire")]
outcomes <- dat[,c("effectiveness", "extraeffort", "satisfaction")]

จากนั้น ใช้ฟังก์ชั่น rda โดยใส่ข้อมูลผลลัพธ์ (outcomes) ไว้ทางซ้ายของ ~ และใส่ . ทางด้านขวา เพื่อแสดงว่าใช้ทุกตัวแปรในข้อมูลในการทำนาย แล้วใส่ข้อมูลตัวแปรต้นใน data จากนั้นใช้คำสั่ง scale=TRUE เพื่อเปลี่ยนตัวแปรตามให้เป็นคะแนนมาตรฐาน จะทำให้น้ำหนักของตัวแปรตามแต่ละตัวเท่ากัน ในการแสดงผลจะใช้คำสั่ง summary แต่เนื่องจากข้อมูลผลลัพธ์ที่ให้มีจำนวนมาก จึงใส่ display=c("sp", "bp", "cn") เพื่อคัดเลือกเฉพาะผลลัพธ์ที่สำคัญ

library(vegan)
out <- rda(outcomes ~ ., data=predictors, scale=TRUE)
summary(out, display=c("sp", "bp", "cn"))
## 
## Call:
## rda(formula = outcomes ~ idealattributed + idealbehavior + individualconsideration +      inspiremotive + intelstimulation + contingentreward + managebyexceptactive +      managebyexceptpassive + laissezfaire, data = predictors,      scale = TRUE) 
## 
## Partitioning of correlations:
##               Inertia Proportion
## Total           3.000      1.000
## Constrained     1.449      0.483
## Unconstrained   1.551      0.517
## 
## Eigenvalues, and their contribution to the correlations 
## 
## Importance of components:
##                        RDA1     RDA2     RDA3    PC1    PC2     PC3
## Eigenvalue            1.404 0.024257 0.020766 0.9477 0.3595 0.24365
## Proportion Explained  0.468 0.008086 0.006922 0.3159 0.1198 0.08122
## Cumulative Proportion 0.468 0.476124 0.483046 0.7990 0.9188 1.00000
## 
## Accumulated constrained eigenvalues
## Importance of components:
##                         RDA1    RDA2    RDA3
## Eigenvalue            1.4041 0.02426 0.02077
## Proportion Explained  0.9689 0.01674 0.01433
## Cumulative Proportion 0.9689 0.98567 1.00000
## 
## Scaling 2 for species and site scores
## * Species are scaled proportional to eigenvalues
## * Sites are unscaled: weighted dispersion equal on all dimensions
## * General scaling constant of scores:  4.949232 
## 
## 
## Species scores
## 
##                 RDA1    RDA2     RDA3    PC1      PC2     PC3
## effectiveness -1.998  0.3459  0.08964 -1.662  0.05502 -1.1300
## extraeffort   -2.088 -0.1158 -0.30593 -1.191  1.42546  0.4975
## satisfaction  -1.764 -0.2549  0.26062 -1.886 -0.94881  0.6819
## 
## 
## Biplot scores for constraining variables
## 
##                            RDA1     RDA2      RDA3 PC1 PC2 PC3
## idealattributed         -0.7946  0.08856  0.040192   0   0   0
## idealbehavior           -0.7339 -0.38873 -0.424897   0   0   0
## individualconsideration -0.5599 -0.08403  0.387938   0   0   0
## inspiremotive           -0.8595  0.07141 -0.270445   0   0   0
## intelstimulation        -0.7498  0.31358 -0.112442   0   0   0
## contingentreward        -0.8303 -0.19942  0.261010   0   0   0
## managebyexceptactive    -0.4504  0.26206 -0.198898   0   0   0
## managebyexceptpassive    0.1304 -0.14919  0.005418   0   0   0
## laissezfaire             0.3372 -0.47994 -0.116897   0   0   0

ส่วนต่างๆ ของผลลัพธ์เป็นดังนี้

สามารถหาค่าสัมประสิทธิ์การทำนายที่ปรับแล้ว (Adjusted \(R^2\)) ได้ดังนี้

RsquareAdj(out)
## $r.squared
## [1] 0.4830462
## 
## $adj.r.squared
## [1] 0.4586871

การทดสอบนัยสำคัญสามารถตรวจสอบได้ทั้งหมด 3 รูปแบบ แบบแรกคือทดสอบว่าตัวแปรอิสระทั้งหมด สามารถสร้างผลรวมใดผลรวมหนึ่งแล้วทำนายตัวแปรตามได้อย่างมีนัยสำคัญหรือไม่ ซึ่งการทดสอบนี้พบผลนัยสำคัญ

anova.cca(out)
## Permutation test for rda under reduced model
## Permutation: free
## Number of permutations: 999
## 
## Model: rda(formula = outcomes ~ idealattributed + idealbehavior + individualconsideration + inspiremotive + intelstimulation + contingentreward + managebyexceptactive + managebyexceptpassive + laissezfaire, data = predictors, scale = TRUE)
##           Df Variance     F Pr(>F)    
## Model      9   1.4491 19.83  0.001 ***
## Residual 191   1.5509                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

ต่อไป สามารถตรวจสอบได้ว่าผลรวมแต่ละตัว สามารถอธิบายตัวแปรตามได้อย่างมีนัยสำคัญหรือไม่ พบว่ามีเพียงผลรวมแรกที่ถึงระดับนัยสำคัญ

anova.cca(out, by="axis")
## Permutation test for rda under reduced model
## Forward tests for axes
## Permutation: free
## Number of permutations: 999
## 
## Model: rda(formula = outcomes ~ idealattributed + idealbehavior + individualconsideration + inspiremotive + intelstimulation + contingentreward + managebyexceptactive + managebyexceptpassive + laissezfaire, data = predictors, scale = TRUE)
##           Df Variance        F Pr(>F)    
## RDA1       1  1.40412 178.3594  0.001 ***
## RDA2       1  0.02426   3.0813  0.889    
## RDA3       1  0.02077   2.6378  0.990    
## Residual 197  1.55086                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

นอกจากนี้ สามารถตรวจสอบได้ว่า ตัวแปรอิสระแต่ละตัว หากลดออกจากโมเดลแล้ว จะทำให้การทำนายตัวแปรตามเปลี่ยนแปลงไปอย่างมีนัยสำคัญหรือไม่ ซึ่งถึงระดับนัยสำคัญ แสดงว่าตัวแปรทำนายดังกล่าว สามารถทำนายตัวแปรตามได้เพิ่มเติมจากตัวแปรอื่น การแปลความหมายคล้ายกับสัมประสิทธิ์ถดถอย

anova.cca(out, by="margin")
## Permutation test for rda under reduced model
## Marginal effects of terms
## Permutation: free
## Number of permutations: 999
## 
## Model: rda(formula = outcomes ~ idealattributed + idealbehavior + individualconsideration + inspiremotive + intelstimulation + contingentreward + managebyexceptactive + managebyexceptpassive + laissezfaire, data = predictors, scale = TRUE)
##                          Df Variance      F Pr(>F)    
## idealattributed           1  0.03590 4.4218  0.015 *  
## idealbehavior             1  0.02581 3.1788  0.057 .  
## individualconsideration   1  0.01241 1.5288  0.214    
## inspiremotive             1  0.06790 8.3620  0.004 ** 
## intelstimulation          1  0.02298 2.8302  0.063 .  
## contingentreward          1  0.08016 9.8724  0.001 ***
## managebyexceptactive      1  0.01357 1.6711  0.175    
## managebyexceptpassive     1  0.00100 0.1237  0.901    
## laissezfaire              1  0.01426 1.7564  0.155    
## Residual                191  1.55086                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

นอกจากนี้ สามารถนำค่า Eigenvalues ของผลรวมต่างๆ ไปสร้างเป็นกราฟเพื่อตรวจสอบการตกลงของค่า Eigenvalues จากผลรวมลำดับต่างๆ เรียกว่า Scree Plot การแปลความหมายคล้ายๆ กับการวิเคราะห์องค์ประกอบเชิงสำรวจ (Exploratory Factor Analysis) ที่ผลรวมท้ายๆ จะเป็นค่าที่ทำนายตัวแปรเดียวโดดๆ แต่ผลรวมแรกๆ จะเป็นการทำนายตัวแปรมากกว่า 1 ตัว เมื่อไรก็ตามที่เห็นการตกลงของค่า Eigenvalues ในกราฟ เหมือนการตกหน้าผา ด้านซ้ายของหน้าผา คือจำนวนผลรวมที่ควรเก็บไว้

screeplot(out)

จากข้อมูลนี้ พบว่าผลรวมแรกเพียงอย่างเดียวน่าจะเพียงพอในการอธิบายความสัมพันธ์ระหว่างตัวแปรทำนายและตัวแปรผลลัพธ์ ซึ่งหากอ่านผลรวมกับการทดสอบนัยสำคัญของผลรวมแต่ละตัว พบว่ามีเพียงผลรวมแรกที่ถึงระดับนัยสำคัญ และผลรวมแรกเป็นเพียงตัวเดียวที่มีความสามารถในการทำนายตัวแปรตามเกิน 1% จากเหตุผลเหล่านี้ จึงสนใจเพียงเฉพาะผลรวมแรกเท่านั้น

ในการสร้างค่าที่ทำนายได้ (Predicted Values) โดยใช้คำสั่ง predict สามารถสร้างค่าทำนายได้ 2 แบบ แบบแรกคือค่าของตัวแปรตามที่ทำนายได้จากผลรวม 3 ตัว ใส่ type="response" เพื่อหาค่าที่ทำนายได้ของตัวแปรตาม

predictedresponse <- predict(out, type="response")
head(predictedresponse)
##      effectiveness extraeffort satisfaction
## row1      16.09657    13.11227     8.721248
## row2      13.73913    10.47603     6.774254
## row3      17.07414    13.44648     9.053419
## row4      18.34000    14.41643    10.285864
## row5      14.16427    10.66251     7.475407
## row6      13.23429    10.59562     7.270698

อย่างไรก็ตาม ผลรวมที่น่าสนใจมีเพียงผลรวมแรกเพียงอย่างเดียว ดังนั้นจึงอาจเลือกหาค่าที่ทำนายได้ของตัวแปรตาม เมื่อใช้ผลรวมเพียงแค่ตัวแปรเดียว โดยใส่ rank=1

predictedresponse2 <- predict(out, type="response", rank=1)
head(predictedresponse2)
##      effectiveness extraeffort satisfaction
## row1      16.35620    12.89647     8.746324
## row2      13.17811    10.39769     7.194239
## row3      17.04295    13.43644     9.081715
## row4      18.63781    14.69040     9.860598
## row5      13.80596    10.89134     7.500865
## row6      13.33589    10.52175     7.271296

นอกจากนี้ ยังสามารถหาของผลรวม ซึ่งก็คือค่าดัชนี ในการวัดแบบก่อรูป (Formative Measurement) โดยใส่ type="lc" เพื่อหาค่าที่ทำนายได้ของตัวแปรตาม

predictedlc <- predict(out, type="lc")
head(predictedlc)
##             RDA1         RDA2         RDA3
## row1 -0.05113387 -0.040906826 -0.052648675
## row2  0.06445236  0.137797687 -0.076883899
## row3 -0.07611101  0.008175222 -0.006264553
## row4 -0.13411569 -0.094228874  0.122159738
## row5  0.04161746  0.062713434  0.048509615
## row6  0.05871381 -0.016968396 -0.016898348

สมมติว่ามีค่าของตัวแปรทำนายใหม่ 2 ชุด ชุดแรก ตัวแปรทำนาย 6 ตัวแรกมีค่าสูงสุด (20) และ 3 ตัวหลังมีค่าต่ำสุด (4) ส่วนชุดที่สอง ตัวแปรทำนาย 6 ตัวแรกมีค่าต่ำสุด (4) และ 3 ตัวหลังมีค่าสูงสุด (20) สร้างชุดข้อมูลในรูปแบบ data.frame

predictvarnames <- c("idealattributed", "idealbehavior", 
                    "individualconsideration", "inspiremotive", 
                    "intelstimulation", "contingentreward", 
                    "managebyexceptactive", "managebyexceptpassive", 
                    "laissezfaire")
predictorvalues <- c(20, 20, 20, 20, 20, 20, 4, 4, 4)
predictorvalues2 <- c(4, 4, 4, 4, 4, 4, 20, 20, 20)
predval <- rbind(predictorvalues, predictorvalues2)
colnames(predval) <- predictvarnames
predval <- data.frame(predval)

จากนั้น นำข้อมูลใหม่ที่ได้มา เอาไปสร้างค่าที่ทำนายได้

predict(out, type="response", newdata=predval)
##                  effectiveness extraeffort satisfaction
## predictorvalues      19.972302   15.946687    11.350541
## predictorvalues2      2.437021    2.200657     1.150307
predict(out, type="response", newdata=predval, rank=1)
##                  effectiveness extraeffort satisfaction
## predictorvalues      20.538138   16.184539    10.788661
## predictorvalues2      2.113537    1.698143     1.790633
predict(out, type="lc", newdata=predval)
##                        RDA1       RDA2       RDA3
## predictorvalues  -0.2032300 -0.1533886  0.1331467
## predictorvalues2  0.4668676  0.1209378 -0.2044219

สุดท้ายนี้ นักวิจัยสามารถที่จะลดจำนวนตัวแปรทำนายได้ เหมือนกับการวิเคราะห์ถดถอย ในที่นี้อาจใช้วิธี Stepwise ในการคัดเลือกตัวแปรทำนาย สามารถทำได้ผ่านคำสั่ง ordiR2step โดยค่าแรก ให้ใส่โมเดลเริ่มต้น ซึ่งเป็นโมเดลที่มีแต่จุดตัด ไม่มีตัวแปรต้นเลย (ใส่แค่ 1 ในการทำนาย) ส่วนค่าที่สอง scope คือโมเดลสูงที่สุดที่ทำได้ ซึ่งก็คือดึงมาจากโมเดลเดิม ที่ตัวแปรทำนายทั้ง 9 ตัวอยู่ในโมเดล ค่าที่ 3 direction คือวิธีการคัดเลือกโมเดล ในที่นี้เลือกวิธี stepwise ส่วนค่าที่ 4 R2scope เป็นการสร้างเงื่อนไขว่า ค่า Adjusted \(R^2\) ของโมเดลสุดท้าย ต้องไม่มากกว่าโมเดลสูงสุดที่เป็นไปได้ หากการใส่ตัวแปรทำให้ Adjusted \(R^2\) สูงกว่าโมเดลสุดท้าย ให้ตัดจบ และค่าที่ 5 trace คือการแสดงลำดับการคัดเลือก หากผู้ใช้ต้องการลดการแสดงผล ให้เปลี่ยนตัวนี้เป็น FALSE ได้

minmodel <- rda(outcomes ~ 1, data = predictors, scale=TRUE)
stepwise <- ordiR2step(minmodel, scope = formula(out), direction = "stepwise", R2scope = TRUE, trace = TRUE) 
## Step: R2.adj= 0 
## Call: outcomes ~ 1 
##  
##                           R2.adjusted
## <All variables>           0.458687100
## + inspiremotive           0.343028816
## + contingentreward        0.320094441
## + idealattributed         0.292069645
## + intelstimulation        0.260287610
## + idealbehavior           0.250803778
## + individualconsideration 0.143520648
## + managebyexceptactive    0.091235221
## + laissezfaire            0.050430190
## + managebyexceptpassive   0.003152924
## <none>                    0.000000000
## 
##                 Df    AIC      F Pr(>F)   
## + inspiremotive  1 138.37 105.43  0.002 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Step: R2.adj= 0.3430288 
## Call: outcomes ~ inspiremotive 
##  
##                           R2.adjusted
## <All variables>             0.4586871
## + contingentreward          0.4217848
## + intelstimulation          0.3982553
## + individualconsideration   0.3791004
## + idealbehavior             0.3778956
## + idealattributed           0.3775494
## + laissezfaire              0.3524756
## + managebyexceptactive      0.3484891
## <none>                      0.3430288
## + managebyexceptpassive     0.3423148
## 
##                    Df    AIC      F Pr(>F)   
## + contingentreward  1 113.69 28.105  0.002 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Step: R2.adj= 0.4217848 
## Call: outcomes ~ inspiremotive + contingentreward 
##  
##                           R2.adjusted
## <All variables>             0.4586871
## + idealattributed           0.4372153
## + intelstimulation          0.4370966
## + idealbehavior             0.4317156
## + laissezfaire              0.4289117
## + individualconsideration   0.4284253
## + managebyexceptpassive     0.4227849
## <none>                      0.4217848
## + managebyexceptactive      0.4206428
## 
##                   Df    AIC      F Pr(>F)   
## + idealattributed  1 109.23 6.4288  0.002 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Step: R2.adj= 0.4372153 
## Call: outcomes ~ inspiremotive + contingentreward + idealattributed 
##  
##                           R2.adjusted
## <All variables>             0.4586871
## + intelstimulation          0.4498937
## + laissezfaire              0.4464124
## + idealbehavior             0.4440588
## + individualconsideration   0.4400586
## + managebyexceptpassive     0.4378150
## <none>                      0.4372153
## + managebyexceptactive      0.4361573
## 
##                    Df    AIC      F Pr(>F)  
## + intelstimulation  1 105.63 5.5403   0.02 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Step: R2.adj= 0.4498937 
## Call: outcomes ~ inspiremotive + contingentreward + idealattributed +      intelstimulation 
##  
##                           R2.adjusted
## <All variables>             0.4586871
## + idealbehavior             0.4549636
## + laissezfaire              0.4537426
## + individualconsideration   0.4501236
## <none>                      0.4498937
## + managebyexceptactive      0.4498815
## + managebyexceptpassive     0.4491019
## 
##                 Df    AIC      F Pr(>F)  
## + idealbehavior  1 104.74 2.8232  0.034 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Step: R2.adj= 0.4549636 
## Call: outcomes ~ inspiremotive + contingentreward + idealattributed +      intelstimulation + idealbehavior 
##  
##                           R2.adjusted
## + laissezfaire              0.4589799
## <All variables>             0.4586871
## + managebyexceptactive      0.4557345
## + individualconsideration   0.4551852
## <none>                      0.4549636
## + managebyexceptpassive     0.4542901
stepwise
## Call: rda(formula = outcomes ~ inspiremotive + contingentreward +
## idealattributed + intelstimulation + idealbehavior, data = predictors,
## scale = TRUE)
## 
##               Inertia Proportion Rank
## Total          3.0000     1.0000     
## Constrained    1.4058     0.4686    3
## Unconstrained  1.5942     0.5314    3
## Inertia is correlations 
## 
## Eigenvalues for constrained axes:
##   RDA1   RDA2   RDA3 
## 1.3730 0.0183 0.0145 
## 
## Eigenvalues for unconstrained axes:
##    PC1    PC2    PC3 
## 0.9827 0.3616 0.2499

การคำนวณอัตราการเจอคนที่ใช่ (Hit Rate) ด้วยแนวคิดของ Taylor & Russell (1939)

ส่วนนี้จะแสดง code ที่ใช้ในการคำนวณผลที่อยู่ในตารางของ Taylor & Russell (1939) โดยท่านต้องกำหนดค่า 3 ค่า ดังนี้

ตัวอย่างที่ 1 อัตราส่วนของคนที่จะเลือกต่อคนที่รับสมัครเท่ากับ 20% อัตราส่วนในการเจอคนที่ใช้เท่ากับ 30% และค่าสหสัมพันธ์ของแบบทดสอบเท่ากับ .25 สามารถแทนค่าใน code ได้ดังข้างล่าง พบว่าโอกาสในการเจอคนที่ใช่เท่ากับ 43%

sr <- 0.2
br <- 0.3
r <- 0.25
library(mvtnorm)
zx <- qnorm(1 - sr)
zy <- qnorm(1 - br)
r <- matrix(c(1, r, r, 1), 2, 2)
q1 <- pmvnorm(lower = c(zx, zy), mean=c(0,0), corr=r)
q1q4 <- pmvnorm(lower = c(zx, -Inf), mean=c(0,0), corr=r)
q1/q1q4
## [1] 0.4288783
## attr(,"error")
## [1] 1e-15
## attr(,"msg")
## [1] "Normal Completion"

ตัวอย่างที่ 2 อัตราส่วนของคนที่จะเลือกต่อคนที่รับสมัครเท่ากับ 60% อัตราส่วนในการเจอคนที่ใช้เท่ากับ 70% และค่าสหสัมพันธ์ของแบบทดสอบเท่ากับ .5 สามารถแทนค่าใน code ได้ดังข้างล่าง พบว่าโอกาสในการเจอคนที่ใช่เท่ากับ 82%

sr <- 0.6
br <- 0.7
r <- 0.5
library(mvtnorm)
zx <- qnorm(1 - sr)
zy <- qnorm(1 - br)
r <- matrix(c(1, r, r, 1), 2, 2)
q1 <- pmvnorm(lower = c(zx, zy), mean=c(0,0), corr=r)
q1q4 <- pmvnorm(lower = c(zx, -Inf), mean=c(0,0), corr=r)
q1/q1q4
## [1] 0.8198178
## attr(,"error")
## [1] 1e-15
## attr(,"msg")
## [1] "Normal Completion"

การคำนวณค่าเฉลี่ยของเกณฑ์เมื่อใช้แบบวัด ด้วยแนวคิดของ Naylor & Shines (1965)

ส่วนนี้จะแสดง code ที่ใช้ในการคำนวณผลที่อยู่ในตารางของ Naylor & Shines (1965) โดยท่านต้องกำหนดค่า 2 ค่า คือ sr และ r ซึ่งมีความหมายเหมือนกับการกำหนดตาราง Taylor & Russell

ตัวอย่างที่ 1 อัตราส่วนของคนที่จะเลือกต่อคนที่รับสมัครเท่ากับ 20% และค่าสหสัมพันธ์ของแบบทดสอบเท่ากับ .25 สามารถแทนค่าใน code ได้ดังข้างล่าง พบว่าค่าเฉลี่ยของคนที่ถูกคัดเลือกมา จะมีค่าเท่ากับคะแนนมาตรฐาน 0.35

sr <- 0.2
r <- 0.25
zx <- qnorm(1 - sr)
lambda <- dnorm(zx)
r * lambda / sr
## [1] 0.3499524

ตัวอย่างที่ 2 อัตราส่วนของคนที่จะเลือกต่อคนที่รับสมัครเท่ากับ 60% และค่าสหสัมพันธ์ของแบบทดสอบเท่ากับ .5 สามารถแทนค่าใน code ได้ดังข้างล่าง พบว่าค่าเฉลี่ยของคนที่ถูกคัดเลือกมา จะมีค่าเท่ากับคะแนนมาตรฐาน 0.32

sr <- 0.6
r <- 0.5
zx <- qnorm(1 - sr)
lambda <- dnorm(zx)
r * lambda / sr
## [1] 0.3219521