1 DATA LAODING

library(bruceR)
library(metafor) # standard meta-analyses
library(xlsx)
library(stringr)
library(robumeta) # package for RVE meta-analyses
library(clubSandwich)
# Yongxuan
data <- import("JIBSb6.csv") %>% setDT()
# Yongxuan https://docs.google.com/spreadsheets/d/12jjiYohd_QHxyAaX_S5jYxqZ6J4HnrzL/edit?usp=sharing&ouid=115346063709313800668&rtpof=true&sd=true
LBsR_aaa <- data[, .SD, .SDcols = patterns("aaa")]
# str(LBsR_aaa)

# 删除 ib1 变量中值为缺失的行
LBsR <- data[!is.na(ib1)] %>%
  .[relation != ""] %>% # 清除不用的数据(Yongxuan)# 删除 relation 为空字符串的行
  .[analysiscategory1 == "behavior", analysiscategory1 := "behaviors"] %>%
  .[analysiscategory2 == "behavior", analysiscategory2 := "behaviors"] %>%
  .[, analysiscategory1 := toupper(analysiscategory1)] %>%
  .[, analysiscategory2 := toupper(analysiscategory2)] %>%
  .[, aaa.analysisvariable1 := tolower(aaa.analysisvariable1)] %>%
  .[, aaa.analysisvariable2 := tolower(aaa.analysisvariable2)] %>%
  .[
    aaa.analysisvariable1 %in% c("commitment", "job involvement", "withdraw"),
    analysiscategory1 := "WORKPLACE ATTACHMENT"
  ] %>%
  .[
    aaa.analysisvariable1 %in% c("justice", "perception of support", "perceptions of support"),
    analysiscategory1 := "SOCIAL EXCHANGE AT WORKPLACE"
  ] %>%
  .[
    aaa.analysisvariable2 %in% c("commitment", "job involvement", "withdraw"),
    analysiscategory2 := "WORKPLACE ATTACHMENT"
  ] %>%
  .[
    aaa.analysisvariable2 %in% c("justice", "perception of support", "perceptions of support"),
    analysiscategory2 := "SOCIAL EXCHANGE AT WORKPLACE"
  ] %>%
  .[, XX := pmin(analysiscategory1, analysiscategory2)] %>%
  .[, YY := pmax(analysiscategory1, analysiscategory2)] %>%
  .[order(XX, YY)] %>%
  # .[, cc("analysiscategory1,analysiscategory2") := NULL]%>%
  # setnames(old = c("X", "Y"), new = cc("analysiscategory1,analysiscategory2"))%>%
  .[analysiscategory1 == "DETERING INSTITUTIONAL FACTOR", aaa.analysisvariable1 := "detering institutional factor"] %>%
  .[analysiscategory2 == "DETERING INSTITUTIONAL FACTOR", aaa.analysisvariable2 := "detering institutional factor"] %>%
  .[analysiscategory1 == "ATTRACTING INSTITUTIONAL FACTOR", aaa.analysisvariable1 := "attracting institutional factor"] %>%
  .[analysiscategory2 == "ATTRACTING INSTITUTIONAL FACTOR", aaa.analysisvariable2 := "attracting institutional factor"] %>%
  .[, Xx := pmin(aaa.analysisvariable1, aaa.analysisvariable2)] %>%
  .[, Yy := pmax(aaa.analysisvariable1, aaa.analysisvariable2)] # %>%
# .[order(Xx, Yy)]%>%
# .[, cc("aaa.analysisvariable1,aaa.analysisvariable2") := NULL]%>%
# setnames(old = c("Xx", "Yy"), new = cc("aaa.analysisvariable1,aaa.analysisvariable2"))

LBsR[LBsR == ""] <- NA
LBsR2 <- LBsR
# names(LBsR)

2 DATA STRUCTURE

LBsR <- LBsR[, CheckMissingR := rowSums(!is.na(.SD)), .SDcols = c("aaa.hsraw.r", "aaa.hscorrected.r", "aaa.horaw.r", "aaa.hocorrected.r")]
# [, CheckMissingR := rowSums(is.na(.SD)), .SDcols = c("aaa.hsraw.r", "aaa.hscorrected.r",
#                                                         "aaa.horaw.r", "aaa.hocorrected.r")]#%>%
Freq(LBsR$CheckMissingR)
## Frequency Statistics:
## ───────────
##      N    %
## ───────────
## 0   13  0.9
## 1  671 48.7
## 2  694 50.4
## ───────────
## Total N = 1,378
print_table(LBsR[CheckMissingR == 0, .(caseid, aaa.analysisvariable1, aaa.analysisvariable2, CheckMissingR)], row.names = F) # ,aaa.hsraw.r,aaa.hscorrected.r,aaa.horaw.r,aaa.hocorrected.r
## ───────────────────────────────────────────────────────────────────────────────
##  caseid               aaa.analysisvariable1 aaa.analysisvariable2 CheckMissingR
## ───────────────────────────────────────────────────────────────────────────────
##    2119 contextual performance              general performance           0.000
##    2120 contextual performance              general performance           0.000
##    461  organizational capability           internationalization          0.000
##    3822 relational-oriented leader behavior stress                        0.000
##    3823 relational-oriented leader behavior stress                        0.000
##    3850 relational-oriented leader behavior well-being                    0.000
##    3851 relational-oriented leader behavior well-being                    0.000
##    6403 change-oriented leader behavior     team effectiveness            0.000
##    934  motivation to work                  others                        0.000
##    935  motivation to work                  others                        0.000
##    936  motivation to work                  others                        0.000
##    937  motivation to work                  others                        0.000
##    464  internationalization                non-marketing outcome         0.000
## ───────────────────────────────────────────────────────────────────────────────

3 Categories variables and correlates

LBsR <- LBsR[, CategoriesVariablesCorrelates1 := paste(relation, analysiscategory1, aaa.analysisvariable1, aaa.variable1, sep = "#")] %>%
  .[, CategoriesVariablesCorrelates2 := paste(relation, analysiscategory2, aaa.analysisvariable2, aaa.variable2, sep = "#")]
CategoriesVariables <- rbind(as.data.table(LBsR$CategoriesVariablesCorrelates1), as.data.table(LBsR$CategoriesVariablesCorrelates2))

## cat("TABLE 3. All countries")
# Table=FreqT(LBsR$RelationCorrelates)

3.1 IB Variables

# Table=FreqT(CategoriesVariables[grepl("IB#|IBOB#", V1), ]$V1)
unique(CategoriesVariables[grepl("IB#|IBOB#", V1), ]$V1) %>% sort()
##   [1] "IB#ATTRACTING INSTITUTIONAL FACTOR#attracting institutional factor#Customer demand"                                 
##   [2] "IB#ATTRACTING INSTITUTIONAL FACTOR#attracting institutional factor#democratic institution"                          
##   [3] "IB#ATTRACTING INSTITUTIONAL FACTOR#attracting institutional factor#FDI attractiveness"                              
##   [4] "IB#ATTRACTING INSTITUTIONAL FACTOR#attracting institutional factor#institutional quality"                           
##   [5] "IB#ATTRACTING INSTITUTIONAL FACTOR#attracting institutional factor#political stability"                             
##   [6] "IB#ATTRACTING INSTITUTIONAL FACTOR#attracting institutional factor#Regulation"                                      
##   [7] "IB#ATTRACTING INSTITUTIONAL FACTOR#attracting institutional factor#rule of law"                                     
##   [8] "IB#ATTRACTING INSTITUTIONAL FACTOR#attracting institutional factor#Stakeholder norms"                               
##   [9] "IB#ATTRACTING INSTITUTIONAL FACTOR#attracting institutional factor#Subsidy"                                         
##  [10] "IB#COMPETITIVE ADVANTAGES#organizational capability#Absorptive capacity(ACAP)"                                      
##  [11] "IB#COMPETITIVE ADVANTAGES#organizational capability#Dynamic capabilities"                                           
##  [12] "IB#COMPETITIVE ADVANTAGES#organizational capability#Efficiency"                                                     
##  [13] "IB#COMPETITIVE ADVANTAGES#organizational capability#Firm Capabilities"                                              
##  [14] "IB#COMPETITIVE ADVANTAGES#organizational capability#governance structures"                                          
##  [15] "IB#COMPETITIVE ADVANTAGES#organizational capability#hierarchical governance"                                        
##  [16] "IB#COMPETITIVE ADVANTAGES#organizational capability#organizational capabilities"                                    
##  [17] "IB#COMPETITIVE ADVANTAGES#organizational capability#relational governance"                                          
##  [18] "IB#COMPETITIVE ADVANTAGES#organizational capability#Strategic Capabilities"                                         
##  [19] "IB#COMPETITIVE ADVANTAGES#organizational capability#technological capabilities"                                     
##  [20] "IB#COMPETITIVE ADVANTAGES#organizational resource#assest specificity"                                               
##  [21] "IB#COMPETITIVE ADVANTAGES#organizational resource#breadth of knowledge sources"                                     
##  [22] "IB#COMPETITIVE ADVANTAGES#organizational resource#Business ties"                                                    
##  [23] "IB#COMPETITIVE ADVANTAGES#organizational resource#Cohesive Networks"                                                
##  [24] "IB#COMPETITIVE ADVANTAGES#organizational resource#Corporate Reputation"                                             
##  [25] "IB#COMPETITIVE ADVANTAGES#organizational resource#Diverse Networks"                                                 
##  [26] "IB#COMPETITIVE ADVANTAGES#organizational resource#firm size"                                                        
##  [27] "IB#COMPETITIVE ADVANTAGES#organizational resource#Firm Size"                                                        
##  [28] "IB#COMPETITIVE ADVANTAGES#organizational resource#Inter-organizational Trust"                                       
##  [29] "IB#COMPETITIVE ADVANTAGES#organizational resource#Knowledge-Friendly Organisational Culture"                        
##  [30] "IB#COMPETITIVE ADVANTAGES#organizational resource#Long-term institutional ownership"                                
##  [31] "IB#COMPETITIVE ADVANTAGES#organizational resource#Media Visibility"                                                 
##  [32] "IB#COMPETITIVE ADVANTAGES#organizational resource#Non-VRIN resources"                                               
##  [33] "IB#COMPETITIVE ADVANTAGES#organizational resource#organizational social capital"                                    
##  [34] "IB#COMPETITIVE ADVANTAGES#organizational resource#Political ties"                                                   
##  [35] "IB#COMPETITIVE ADVANTAGES#organizational resource#Resources"                                                        
##  [36] "IB#COMPETITIVE ADVANTAGES#organizational resource#VC investments"                                                   
##  [37] "IB#COMPETITIVE ADVANTAGES#organizational resource#VRIN resources"                                                   
##  [38] "IB#DETERING INSTITUTIONAL FACTOR#detering institutional factor#Contextual distance"                                 
##  [39] "IB#DETERING INSTITUTIONAL FACTOR#detering institutional factor#Corruption"                                          
##  [40] "IB#DETERING INSTITUTIONAL FACTOR#detering institutional factor#Cultural differences"                                
##  [41] "IB#DETERING INSTITUTIONAL FACTOR#detering institutional factor#Cultural Distance"                                   
##  [42] "IB#DETERING INSTITUTIONAL FACTOR#detering institutional factor#Firm Risk"                                           
##  [43] "IB#DETERING INSTITUTIONAL FACTOR#detering institutional factor#host country risk"                                   
##  [44] "IB#DETERING INSTITUTIONAL FACTOR#detering institutional factor#Market Concentration"                                
##  [45] "IB#DETERING INSTITUTIONAL FACTOR#detering institutional factor#Tax rates"                                           
##  [46] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic orientation#blockholders"                                        
##  [47] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic orientation#board independence"                                  
##  [48] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic orientation#board interlock"                                     
##  [49] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic orientation#CEO duality"                                         
##  [50] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic orientation#CEO pay"                                             
##  [51] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic orientation#executive compensation"                              
##  [52] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic orientation#family firms"                                        
##  [53] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic orientation#family involvement"                                  
##  [54] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic orientation#insitutional investors"                              
##  [55] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic orientation#Leadership"                                          
##  [56] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic orientation#managerial ownership"                                
##  [57] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic orientation#Managerial ties"                                     
##  [58] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic orientation#Mindsets of top managers"                            
##  [59] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic orientation#state ownership"                                     
##  [60] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#alignment mechanism"                                     
##  [61] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#alliance"                                                
##  [62] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#Business planning"                                       
##  [63] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#Corporate venturing"                                     
##  [64] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#environmental management practices"                      
##  [65] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#Environmental management system(EMS)"                    
##  [66] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#High-performance work practices (HPWPs)"                 
##  [67] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#HR practices"                                            
##  [68] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#Interorganizational arrangements"                        
##  [69] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#investment mechanism"                                    
##  [70] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#joint venture"                                           
##  [71] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#M&A"                                                     
##  [72] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#monitoring mechanism"                                    
##  [73] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#Proactive environmental strategies"                      
##  [74] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#Productivity Measurement and Enhancement System (ProMES)"
##  [75] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#Resource dependence"                                     
##  [76] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#Social&Environmental disclosures"                        
##  [77] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#Strategic performance measurement systems"               
##  [78] "IB#EFFECTIVENESS OF STRATEGIC MANAGEMENT#strategic process#Strategic renewal"                                       
##  [79] "IB#ORGANIZATIONAL OUTCOME#general performance#Business Performance"                                                 
##  [80] "IB#ORGANIZATIONAL OUTCOME#general performance#corporate performance"                                                
##  [81] "IB#ORGANIZATIONAL OUTCOME#general performance#family firm performance"                                              
##  [82] "IB#ORGANIZATIONAL OUTCOME#general performance#firm performance"                                                     
##  [83] "IB#ORGANIZATIONAL OUTCOME#general performance#Firm performance"                                                     
##  [84] "IB#ORGANIZATIONAL OUTCOME#general performance#Firm Performance"                                                     
##  [85] "IB#ORGANIZATIONAL OUTCOME#general performance#General Performance"                                                  
##  [86] "IB#ORGANIZATIONAL OUTCOME#general performance#organization performance"                                             
##  [87] "IB#ORGANIZATIONAL OUTCOME#general performance#Organizational performance"                                           
##  [88] "IB#ORGANIZATIONAL OUTCOME#general performance#Organizational Performance"                                           
##  [89] "IB#ORGANIZATIONAL OUTCOME#general performance#Overall performance"                                                  
##  [90] "IB#ORGANIZATIONAL OUTCOME#general performance#performance"                                                          
##  [91] "IB#ORGANIZATIONAL OUTCOME#general performance#Performance"                                                          
##  [92] "IB#ORGANIZATIONAL OUTCOME#general performance#Performance-related consequences"                                     
##  [93] "IB#ORGANIZATIONAL OUTCOME#general performance#SME performance"                                                      
##  [94] "IB#ORGANIZATIONAL OUTCOME#general performance#VC funded firm performance"                                           
##  [95] "IB#ORGANIZATIONAL OUTCOME#innovation#Environmental innovation"                                                      
##  [96] "IB#ORGANIZATIONAL OUTCOME#innovation#green innovation"                                                              
##  [97] "IB#ORGANIZATIONAL OUTCOME#innovation#innovation"                                                                    
##  [98] "IB#ORGANIZATIONAL OUTCOME#innovation#Innovation"                                                                    
##  [99] "IB#ORGANIZATIONAL OUTCOME#internationalization#Entry strategy"                                                      
## [100] "IB#ORGANIZATIONAL OUTCOME#internationalization#Export Market Orientation"                                           
## [101] "IB#ORGANIZATIONAL OUTCOME#internationalization#foreign ownership strategy"                                          
## [102] "IB#ORGANIZATIONAL OUTCOME#internationalization#International Business Combination"                                  
## [103] "IB#ORGANIZATIONAL OUTCOME#internationalization#international strategic alliances(ISA) performance"                  
## [104] "IB#ORGANIZATIONAL OUTCOME#internationalization#Internationalization"                                                
## [105] "IB#ORGANIZATIONAL OUTCOME#marketing outcome#accounting performance"                                                 
## [106] "IB#ORGANIZATIONAL OUTCOME#marketing outcome#Customer Commitment"                                                    
## [107] "IB#ORGANIZATIONAL OUTCOME#marketing outcome#Customer Loyalty"                                                       
## [108] "IB#ORGANIZATIONAL OUTCOME#marketing outcome#Customer Trust"                                                         
## [109] "IB#ORGANIZATIONAL OUTCOME#marketing outcome#Economic performance"                                                   
## [110] "IB#ORGANIZATIONAL OUTCOME#marketing outcome#financial performance"                                                  
## [111] "IB#ORGANIZATIONAL OUTCOME#marketing outcome#Financial Performance"                                                  
## [112] "IB#ORGANIZATIONAL OUTCOME#marketing outcome#Financial profitability"                                                
## [113] "IB#ORGANIZATIONAL OUTCOME#marketing outcome#Future Financial Performance"                                           
## [114] "IB#ORGANIZATIONAL OUTCOME#marketing outcome#market performance"                                                     
## [115] "IB#ORGANIZATIONAL OUTCOME#non-marketing outcome#Aesthetic quality"                                                  
## [116] "IB#ORGANIZATIONAL OUTCOME#non-marketing outcome#Corporate social performance"                                       
## [117] "IB#ORGANIZATIONAL OUTCOME#non-marketing outcome#Environment performance"                                            
## [118] "IB#ORGANIZATIONAL OUTCOME#non-marketing outcome#Perceived value"                                                    
## [119] "IB#ORGANIZATIONAL OUTCOME#non-marketing outcome#productivity"                                                       
## [120] "IB#ORGANIZATIONAL OUTCOME#non-marketing outcome#Strategy-related consequences"                                      
## [121] "IB#OTHERS#others#Priori Financial Performance"                                                                      
## [122] "IBOB#COMPETITIVE ADVANTAGES#organizational capability#Contractual governance"                                       
## [123] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Behavioural intentions"                                         
## [124] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Collective Employee Turnover"                                   
## [125] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#collective turnover"                                            
## [126] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Emotional intelligence"                                         
## [127] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Employee performance"                                           
## [128] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Employee satisfaction"                                          
## [129] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Entrepreneurial Self Efficacy"                                  
## [130] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Intra-organizational Trust"                                     
## [131] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Management support"                                             
## [132] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Organizational commitment"                                      
## [133] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Trust"                                                          
## [134] "IBOB#ORGANIZATIONAL OUTCOME#general performance#firm performance"                                                   
## [135] "IBOB#ORGANIZATIONAL OUTCOME#general performance#Firm performance"                                                   
## [136] "IBOB#ORGANIZATIONAL OUTCOME#general performance#Firm Performance"                                                   
## [137] "IBOB#ORGANIZATIONAL OUTCOME#general performance#Organizational performance"                                         
## [138] "IBOB#ORGANIZATIONAL OUTCOME#general performance#Organizational Performance"                                         
## [139] "IBOB#ORGANIZATIONAL OUTCOME#innovation#Service innovation"                                                          
## [140] "IBOB#ORGANIZATIONAL OUTCOME#non-marketing outcome#Aesthetic quality"                                                
## [141] "IBOB#ORGANIZATIONAL OUTCOME#non-marketing outcome#Core product quality"                                             
## [142] "IBOB#ORGANIZATIONAL OUTCOME#non-marketing outcome#service quality"

3.2 OB Variables

# Table=Freq(CategoriesVariables[grepl("OB#|IBOB.o#", V1), ]$V1)
unique(CategoriesVariables[grepl("OB#|IBOB.o#", V1), ]$V1) %>% sort()
##   [1] "IBOB.o#BEHAVIORS#contextual performance#Service innovation"                                                      
##   [2] "IBOB.o#BEHAVIORS#task performance#Employee performance"                                                          
##   [3] "IBOB.o#HUMAN CAPITAL#ksao#Emotional intelligence"                                                                
##   [4] "IBOB.o#MOTIVATION#motivation to work#Entrepreneurial Self Efficacy"                                              
##   [5] "IBOB.o#MOTIVATION#motivation to work#Intra-organizational Trust"                                                 
##   [6] "IBOB.o#MOTIVATION#motivation to work#Trust"                                                                      
##   [7] "IBOB.o#MOTIVATION#satisfaction#Employee satisfaction"                                                            
##   [8] "IBOB.o#ORGANIZATIONAL OUTCOME#general performance#firm performance"                                              
##   [9] "IBOB.o#ORGANIZATIONAL OUTCOME#general performance#Firm performance"                                              
##  [10] "IBOB.o#ORGANIZATIONAL OUTCOME#general performance#Firm Performance"                                              
##  [11] "IBOB.o#ORGANIZATIONAL OUTCOME#general performance#Organizational performance"                                    
##  [12] "IBOB.o#ORGANIZATIONAL OUTCOME#general performance#Organizational Performance"                                    
##  [13] "IBOB.o#ORGANIZATIONAL OUTCOME#non-marketing outcome#Aesthetic quality"                                           
##  [14] "IBOB.o#ORGANIZATIONAL OUTCOME#non-marketing outcome#Core product quality"                                        
##  [15] "IBOB.o#ORGANIZATIONAL OUTCOME#non-marketing outcome#service quality"                                             
##  [16] "IBOB.o#OTHERS#others#Behavioural intentions"                                                                     
##  [17] "IBOB.o#OTHERS#others#Contractual governance"                                                                     
##  [18] "IBOB.o#SOCIAL EXCHANGE AT WORKPLACE#perceptions of support#Management support"                                   
##  [19] "IBOB.o#WORKPLACE ATTACHMENT#commitment#Organizational commitment"                                                
##  [20] "IBOB.o#WORKPLACE ATTACHMENT#withdraw#Collective Employee Turnover"                                               
##  [21] "IBOB.o#WORKPLACE ATTACHMENT#withdraw#collective turnover"                                                        
##  [22] "IBOB#COMPETITIVE ADVANTAGES#organizational capability#Contractual governance"                                    
##  [23] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Behavioural intentions"                                      
##  [24] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Collective Employee Turnover"                                
##  [25] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#collective turnover"                                         
##  [26] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Emotional intelligence"                                      
##  [27] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Employee performance"                                        
##  [28] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Employee satisfaction"                                       
##  [29] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Entrepreneurial Self Efficacy"                               
##  [30] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Intra-organizational Trust"                                  
##  [31] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Management support"                                          
##  [32] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Organizational commitment"                                   
##  [33] "IBOB#COMPETITIVE ADVANTAGES#organizational resource#Trust"                                                       
##  [34] "IBOB#ORGANIZATIONAL OUTCOME#general performance#firm performance"                                                
##  [35] "IBOB#ORGANIZATIONAL OUTCOME#general performance#Firm performance"                                                
##  [36] "IBOB#ORGANIZATIONAL OUTCOME#general performance#Firm Performance"                                                
##  [37] "IBOB#ORGANIZATIONAL OUTCOME#general performance#Organizational performance"                                      
##  [38] "IBOB#ORGANIZATIONAL OUTCOME#general performance#Organizational Performance"                                      
##  [39] "IBOB#ORGANIZATIONAL OUTCOME#innovation#Service innovation"                                                       
##  [40] "IBOB#ORGANIZATIONAL OUTCOME#non-marketing outcome#Aesthetic quality"                                             
##  [41] "IBOB#ORGANIZATIONAL OUTCOME#non-marketing outcome#Core product quality"                                          
##  [42] "IBOB#ORGANIZATIONAL OUTCOME#non-marketing outcome#service quality"                                               
##  [43] "OB#BEHAVIORS#contextual performance#Communication"                                                               
##  [44] "OB#BEHAVIORS#contextual performance#counterproductive work behavior"                                             
##  [45] "OB#BEHAVIORS#contextual performance#creativity"                                                                  
##  [46] "OB#BEHAVIORS#contextual performance#Creativity"                                                                  
##  [47] "OB#BEHAVIORS#contextual performance#Individual-level employee innovation"                                        
##  [48] "OB#BEHAVIORS#contextual performance#innovation"                                                                  
##  [49] "OB#BEHAVIORS#contextual performance#knowledge sharing"                                                           
##  [50] "OB#BEHAVIORS#contextual performance#Knowledge sharing"                                                           
##  [51] "OB#BEHAVIORS#contextual performance#Negotiation Performance"                                                     
##  [52] "OB#BEHAVIORS#contextual performance#OCB"                                                                         
##  [53] "OB#BEHAVIORS#contextual performance#OCB-Inclusive role breadth"                                                  
##  [54] "OB#BEHAVIORS#contextual performance#OCBI"                                                                        
##  [55] "OB#BEHAVIORS#contextual performance#OCBO"                                                                        
##  [56] "OB#BEHAVIORS#contextual performance#open-minded discussion"                                                      
##  [57] "OB#BEHAVIORS#contextual performance#organization directed deviance"                                              
##  [58] "OB#BEHAVIORS#contextual performance#organizational citizenship behavior"                                         
##  [59] "OB#BEHAVIORS#contextual performance#Organizational citizenship behavior"                                         
##  [60] "OB#BEHAVIORS#contextual performance#Pro-environmental behaviour"                                                 
##  [61] "OB#BEHAVIORS#contextual performance#Reciprocity"                                                                 
##  [62] "OB#BEHAVIORS#contextual performance#Supervisor-directed deviance"                                                
##  [63] "OB#BEHAVIORS#contextual performance#Voice"                                                                       
##  [64] "OB#BEHAVIORS#task performance#Individual performance"                                                            
##  [65] "OB#BEHAVIORS#task performance#job performance"                                                                   
##  [66] "OB#BEHAVIORS#task performance#Job performance"                                                                   
##  [67] "OB#BEHAVIORS#task performance#Job Performance"                                                                   
##  [68] "OB#BEHAVIORS#task performance#Objective performance"                                                             
##  [69] "OB#BEHAVIORS#task performance#Overall job performance"                                                           
##  [70] "OB#BEHAVIORS#task performance#Performance"                                                                       
##  [71] "OB#BEHAVIORS#task performance#Subjective Performance"                                                            
##  [72] "OB#BEHAVIORS#task performance#Subjective team performance"                                                       
##  [73] "OB#BEHAVIORS#task performance#Subordinate work performance"                                                      
##  [74] "OB#BEHAVIORS#task performance#Task performance"                                                                  
##  [75] "OB#BEHAVIORS#task performance#Task Performance"                                                                  
##  [76] "OB#CONSTRUCTIVE LEADERSHIP#abusive supervision#abusive supervision"                                              
##  [77] "OB#CONSTRUCTIVE LEADERSHIP#abusive supervision#leader mistreatment"                                              
##  [78] "OB#CONSTRUCTIVE LEADERSHIP#change-oriented leader behavior#perception of transformational/charismatic leadership"
##  [79] "OB#CONSTRUCTIVE LEADERSHIP#change-oriented leader behavior#Romance of Leadership"                                
##  [80] "OB#CONSTRUCTIVE LEADERSHIP#change-oriented leader behavior#supervisor transformational leadership"               
##  [81] "OB#CONSTRUCTIVE LEADERSHIP#change-oriented leader behavior#Transformational Leadership"                          
##  [82] "OB#CONSTRUCTIVE LEADERSHIP#relational-oriented leader behavior#Leader Member Exchange"                           
##  [83] "OB#CONSTRUCTIVE LEADERSHIP#relational-oriented leader behavior#leader-member exchange"                           
##  [84] "OB#CONSTRUCTIVE LEADERSHIP#relational-oriented leader behavior#Leader–Member Exchange"                           
##  [85] "OB#CONSTRUCTIVE LEADERSHIP#relational-oriented leader behavior#LMX"                                              
##  [86] "OB#CONSTRUCTIVE LEADERSHIP#relational-oriented leader behavior#Person-focused leader behaviors"                  
##  [87] "OB#CONSTRUCTIVE LEADERSHIP#relational-oriented leader behavior#Person-focused leadership"                        
##  [88] "OB#CONSTRUCTIVE LEADERSHIP#task-oriented behavior#Tasked-focused leadership"                                     
##  [89] "OB#CONSTRUCTIVE LEADERSHIP#value-based and moral leader behavior#Servant leadership"                             
##  [90] "OB#HEALTH#stress#(reduced) personal accomplishment"                                                              
##  [91] "OB#HEALTH#stress#burnout"                                                                                        
##  [92] "OB#HEALTH#stress#depersonalisation"                                                                              
##  [93] "OB#HEALTH#stress#depersonalization"                                                                              
##  [94] "OB#HEALTH#stress#depression"                                                                                     
##  [95] "OB#HEALTH#stress#emotional exhaustion"                                                                           
##  [96] "OB#HEALTH#stress#Emotional exhaustion"                                                                           
##  [97] "OB#HEALTH#stress#Emotional Exhaustion"                                                                           
##  [98] "OB#HEALTH#stress#Family interference with work"                                                                  
##  [99] "OB#HEALTH#stress#Home/family strain"                                                                             
## [100] "OB#HEALTH#stress#Job demands "                                                                                   
## [101] "OB#HEALTH#stress#Negative family-to-work spillover"                                                              
## [102] "OB#HEALTH#stress#negative state"                                                                                 
## [103] "OB#HEALTH#stress#Negative work-to-family spillover"                                                              
## [104] "OB#HEALTH#stress#Overall Role Stress"                                                                            
## [105] "OB#HEALTH#stress#Psychological Distress"                                                                         
## [106] "OB#HEALTH#stress#Role ambiguity"                                                                                 
## [107] "OB#HEALTH#stress#Role Ambiguity"                                                                                 
## [108] "OB#HEALTH#stress#Role conflict"                                                                                  
## [109] "OB#HEALTH#stress#Role Conflict"                                                                                  
## [110] "OB#HEALTH#stress#Role Overload"                                                                                  
## [111] "OB#HEALTH#stress#self-regulatory capacity impairment"                                                            
## [112] "OB#HEALTH#stress#state negative affect"                                                                          
## [113] "OB#HEALTH#stress#Stress"                                                                                         
## [114] "OB#HEALTH#stress#Work interference with family"                                                                  
## [115] "OB#HEALTH#stress#Work strain"                                                                                    
## [116] "OB#HEALTH#well-being#Family Satisfaction"                                                                        
## [117] "OB#HEALTH#well-being#family-work enrichment"                                                                     
## [118] "OB#HEALTH#well-being#Family-Work Enrichment"                                                                     
## [119] "OB#HEALTH#well-being#Home support"                                                                               
## [120] "OB#HEALTH#well-being#Life satisfaction"                                                                          
## [121] "OB#HEALTH#well-being#mental health"                                                                              
## [122] "OB#HEALTH#well-being#Mental health & well-being"                                                                 
## [123] "OB#HEALTH#well-being#Positive family-to-work spillover"                                                          
## [124] "OB#HEALTH#well-being#Positive work-to-family spillover"                                                          
## [125] "OB#HEALTH#well-being#Self-enjoyment"                                                                             
## [126] "OB#HEALTH#well-being#Subjective Well-being"                                                                      
## [127] "OB#HEALTH#well-being#Support from home"                                                                          
## [128] "OB#HEALTH#well-being#Work-family enrichment"                                                                     
## [129] "OB#HEALTH#well-being#Work-Family Enrichment"                                                                     
## [130] "OB#HUMAN CAPITAL#ksao#Education"                                                                                 
## [131] "OB#HUMAN CAPITAL#ksao#Emotional Intelligence"                                                                    
## [132] "OB#HUMAN CAPITAL#ksao#Psychological capital"                                                                     
## [133] "OB#HUMAN CAPITAL#working experiences#Organization tenure"                                                        
## [134] "OB#HUMAN CAPITAL#working experiences#Organizational tenure"                                                      
## [135] "OB#HUMAN CAPITAL#working experiences#Position tenure"                                                            
## [136] "OB#MOTIVATION#motivation to work#achievement motivation"                                                         
## [137] "OB#MOTIVATION#motivation to work#Anticipated pay increase/promotion"                                             
## [138] "OB#MOTIVATION#motivation to work#Autonomy"                                                                       
## [139] "OB#MOTIVATION#motivation to work#Intra-organizational Trust"                                                     
## [140] "OB#MOTIVATION#motivation to work#Job Control"                                                                    
## [141] "OB#MOTIVATION#motivation to work#Motivators"                                                                     
## [142] "OB#MOTIVATION#motivation to work#Proactive personality"                                                          
## [143] "OB#MOTIVATION#motivation to work#public service motivation"                                                      
## [144] "OB#MOTIVATION#motivation to work#Self-efficacy"                                                                  
## [145] "OB#MOTIVATION#motivation to work#Social trust"                                                                   
## [146] "OB#MOTIVATION#motivation to work#Trust"                                                                          
## [147] "OB#MOTIVATION#perceived fit#Congruence"                                                                          
## [148] "OB#MOTIVATION#perceived fit#Perceived overqualification"                                                         
## [149] "OB#MOTIVATION#perceived fit#Person–Group (P–G) Fit"                                                              
## [150] "OB#MOTIVATION#perceived fit#Person–Job (P–J) Fit"                                                                
## [151] "OB#MOTIVATION#perceived fit#Person–Organization (P–O) Fit"                                                       
## [152] "OB#MOTIVATION#perceived fit#Person–Supervisor (P–S) Fit"                                                         
## [153] "OB#MOTIVATION#satisfaction#Job & career satisfaction"                                                            
## [154] "OB#MOTIVATION#satisfaction#Job satisfaction"                                                                     
## [155] "OB#MOTIVATION#satisfaction#Job Satisfaction"                                                                     
## [156] "OB#MOTIVATION#satisfaction#Overall job satisfaction"                                                             
## [157] "OB#MOTIVATION#satisfaction#Satisfaction"                                                                         
## [158] "OB#OTHERS#others#actual system use"                                                                              
## [159] "OB#OTHERS#others#Place attachment"                                                                               
## [160] "OB#OTHERS#others#subjective norm"                                                                                
## [161] "OB#OTHERS#others#Subjective norm"                                                                                
## [162] "OB#OTHERS#others#Technology perceptions and usage"                                                               
## [163] "OB#PERSONAL CHARACTERISTICS#demographics#age"                                                                    
## [164] "OB#PERSONAL CHARACTERISTICS#demographics#Age"                                                                    
## [165] "OB#PERSONAL CHARACTERISTICS#demographics#entrepreneurial intention"                                              
## [166] "OB#PERSONAL CHARACTERISTICS#demographics#Entrepreneurial intention"                                              
## [167] "OB#PERSONAL CHARACTERISTICS#demographics#Female"                                                                 
## [168] "OB#PERSONAL CHARACTERISTICS#demographics#gender"                                                                 
## [169] "OB#PERSONAL CHARACTERISTICS#demographics#Gender"                                                                 
## [170] "OB#PERSONAL CHARACTERISTICS#demographics#Gender Differences"                                                     
## [171] "OB#PERSONAL CHARACTERISTICS#demographics#Gender Diversity"                                                       
## [172] "OB#PLASTICITY#extraversion#Extraversion"                                                                         
## [173] "OB#PLASTICITY#openness to experience#Openness to Experience"                                                     
## [174] "OB#SOCIAL EXCHANGE AT WORKPLACE#justice#Distributive justice"                                                    
## [175] "OB#SOCIAL EXCHANGE AT WORKPLACE#justice#fairness"                                                                
## [176] "OB#SOCIAL EXCHANGE AT WORKPLACE#justice#Interactional justice"                                                   
## [177] "OB#SOCIAL EXCHANGE AT WORKPLACE#justice#Organizational Justice"                                                  
## [178] "OB#SOCIAL EXCHANGE AT WORKPLACE#justice#perceptions of unfairness"                                               
## [179] "OB#SOCIAL EXCHANGE AT WORKPLACE#justice#Procedural justice"                                                      
## [180] "OB#SOCIAL EXCHANGE AT WORKPLACE#perception of support#Perceived organizational support"                          
## [181] "OB#SOCIAL EXCHANGE AT WORKPLACE#perception of support#Perceived supervisor support"                              
## [182] "OB#SOCIAL EXCHANGE AT WORKPLACE#perception of support#Rewards"                                                   
## [183] "OB#SOCIAL EXCHANGE AT WORKPLACE#perceptions of support#Idiosyncratic deals"                                      
## [184] "OB#SOCIAL EXCHANGE AT WORKPLACE#perceptions of support#Organizational support"                                   
## [185] "OB#SOCIAL EXCHANGE AT WORKPLACE#perceptions of support#perceived organizational support"                         
## [186] "OB#SOCIAL EXCHANGE AT WORKPLACE#perceptions of support#Service climate"                                          
## [187] "OB#SOCIAL EXCHANGE AT WORKPLACE#perceptions of support#Support for change"                                       
## [188] "OB#SOCIAL EXCHANGE AT WORKPLACE#perceptions of support#Support from work"                                        
## [189] "OB#SOCIAL EXCHANGE AT WORKPLACE#perceptions of support#workplace Support"                                        
## [190] "OB#STABILITY#agreeableness#Agreeableness"                                                                        
## [191] "OB#STABILITY#conscientiousness#Conscientiousness"                                                                
## [192] "OB#STABILITY#emotional stability#Emotional Stability"                                                            
## [193] "OB#STABILITY#neuroticism#Neuroticism"                                                                            
## [194] "OB#TEAM EFFECTIVENESS#team effectiveness#Collective turnover"                                                    
## [195] "OB#TEAM EFFECTIVENESS#team effectiveness#Overall team performance"                                               
## [196] "OB#TEAM EFFECTIVENESS#team effectiveness#Team Effectiveness"                                                     
## [197] "OB#TEAM EFFECTIVENESS#team effectiveness#Team performance"                                                       
## [198] "OB#TEAM EFFECTIVENESS#team effectiveness#Team-level employee innovation"                                         
## [199] "OB#TEAM INPUT#team composition#Cultural diversity"                                                               
## [200] "OB#TEAM INPUT#team structure#Competitive goal interdependence"                                                   
## [201] "OB#TEAM INPUT#team structure#Cooperative goal interdependence"                                                   
## [202] "OB#TEAM INPUT#team structure#Independent goal interdependence"                                                   
## [203] "OB#TEAM INPUT#team structure#Outcome interdependence"                                                            
## [204] "OB#TEAM INPUT#team structure#Task interdependence"                                                               
## [205] "OB#TEAM MEDIATOR#emerging state#collective attitudes/perception"                                                 
## [206] "OB#TEAM MEDIATOR#emerging state#Relationship quality"                                                            
## [207] "OB#TEAM MEDIATOR#emerging state#Social integration"                                                              
## [208] "OB#TEAM MEDIATOR#emerging state#Social network"                                                                  
## [209] "OB#TEAM MEDIATOR#team process#Conflict"                                                                          
## [210] "OB#TEAM MEDIATOR#team process#Relational team functioning"                                                       
## [211] "OB#TEAM MEDIATOR#team process#Task-focused team functioning"                                                     
## [212] "OB#WORKPLACE ATTACHMENT#commitment#affective commitment"                                                         
## [213] "OB#WORKPLACE ATTACHMENT#commitment#Affective commitment"                                                         
## [214] "OB#WORKPLACE ATTACHMENT#commitment#Affective commitment to change"                                               
## [215] "OB#WORKPLACE ATTACHMENT#commitment#Affective Commitment to the Organization"                                     
## [216] "OB#WORKPLACE ATTACHMENT#commitment#affective organizational commitment"                                          
## [217] "OB#WORKPLACE ATTACHMENT#commitment#Commitment"                                                                   
## [218] "OB#WORKPLACE ATTACHMENT#commitment#Commitment to change"                                                         
## [219] "OB#WORKPLACE ATTACHMENT#commitment#Continuance commitment"                                                       
## [220] "OB#WORKPLACE ATTACHMENT#commitment#Continuance commitment to change"                                             
## [221] "OB#WORKPLACE ATTACHMENT#commitment#Continuance Commitment to the Organization"                                   
## [222] "OB#WORKPLACE ATTACHMENT#commitment#Normative commitment"                                                         
## [223] "OB#WORKPLACE ATTACHMENT#commitment#Normative commitment to change"                                               
## [224] "OB#WORKPLACE ATTACHMENT#commitment#Normative Commitment to the Organization"                                     
## [225] "OB#WORKPLACE ATTACHMENT#commitment#Occupational commitment"                                                      
## [226] "OB#WORKPLACE ATTACHMENT#commitment#Organization Commitment"                                                      
## [227] "OB#WORKPLACE ATTACHMENT#commitment#Organizational commitment"                                                    
## [228] "OB#WORKPLACE ATTACHMENT#commitment#Organizational Commitment"                                                    
## [229] "OB#WORKPLACE ATTACHMENT#commitment#Overall/attitudinal commitment"                                               
## [230] "OB#WORKPLACE ATTACHMENT#job involvement#Job involvement"                                                         
## [231] "OB#WORKPLACE ATTACHMENT#job involvement#Work engagement"                                                         
## [232] "OB#WORKPLACE ATTACHMENT#job involvement#Work Engagement"                                                         
## [233] "OB#WORKPLACE ATTACHMENT#withdraw#absences"                                                                       
## [234] "OB#WORKPLACE ATTACHMENT#withdraw#Intent to quit"                                                                 
## [235] "OB#WORKPLACE ATTACHMENT#withdraw#Overall withdrawal cognition"                                                   
## [236] "OB#WORKPLACE ATTACHMENT#withdraw#personnel changes"                                                              
## [237] "OB#WORKPLACE ATTACHMENT#withdraw#Turnover behavior"                                                              
## [238] "OB#WORKPLACE ATTACHMENT#withdraw#turnover intention"                                                             
## [239] "OB#WORKPLACE ATTACHMENT#withdraw#Turnover intention"                                                             
## [240] "OB#WORKPLACE ATTACHMENT#withdraw#Turnover Intention"

3.3 Categories and variables

3.3.1 Variables reverse coding

3.3.1.1 OB Variables

# # 定义需要反向编码的组合列表(4个部分的字符串)
# reverse_list_obvariables <- c(
#   # "IBOB.o#COMPETITIVE ADVANTAGES#organizational resource#Collective Employee Turnover",#在文字中做过了
#   # "IBOB.o#COMPETITIVE ADVANTAGES#organizational resource#collective turnover",
#   "OB#BEHAVIORS#contextual performance#counterproductive work behavior",
#   "OB#BEHAVIORS#contextual performance#organization directed deviance",
#   "OB#BEHAVIORS#contextual performance#Supervisor-directed deviance",
#   "OB#SOCIAL EXCHANGE AT WORKPLACE#justice#perceptions of unfairness",
#   "OB#TEAM EFFECTIVENESS#team effectiveness#Collective turnover",
#   "OB#TEAM MEDIATOR#team process#Conflict"
# )
# 
# 
# # 增加新列 reverse.VariablesOBX,默认赋值为 1
# LBsR[, reverse.VariablesOBX := 1]
# LBsR[, reverse.VariablesOBY := 1]
# # 
# LBsR[CategoriesVariablesCorrelates1 %in% reverse_list_obvariables, reverse.VariablesOBX := -1]
# LBsR[CategoriesVariablesCorrelates2 %in% reverse_list_obvariables, reverse.VariablesOBY := -1]
# 1. 先把需要“反向编码”的组合放在一个向量中
reverse_pairs <- c(
  "contextual performance#counterproductive work behavior",
  "contextual performance#organization directed deviance",
  "contextual performance#Supervisor-directed deviance",
  "justice#perceptions of unfairness",
  "team effectiveness#Collective turnover",
  "team process#Conflict",
  "organizational resource#Collective Employee Turnover",
  "organizational resource#collective turnover"
)

# 2. 给 LBsR 增加一个新列 reverse.VariablesOBX
#    先全部初始化为 0(也可以是 NA 或者其他值)
LBsR$reverse.VariablesOBX <- 1
LBsR$reverse.VariablesOBY <- 1

# 3. 对于那些 (Xx, aaa.variable1) 字符串用 "#" 连接后
#    恰好出现在 reverse_pairs 向量里的行,赋值为 -1
LBsR$reverse.VariablesOBX[
  paste(LBsR$aaa.analysisvariable1, LBsR$aaa.variable1, sep = "#") %in% reverse_pairs
] <- -1

LBsR$reverse.VariablesOBY[
  paste(LBsR$aaa.analysisvariable2, LBsR$aaa.variable2, sep = "#") %in% reverse_pairs
] <- -1

3.3.1.2 IB Variables

# 1. 先把需要“反向编码”的组合放在一个向量中
reverse_pairs_IB <- c(
  "organizational resource#Collective Employee Turnover",
  "organizational resource#collective turnover"
)

# 2. 给 LBsR 增加一个新列 reverse.VariablesOBX
#    先全部初始化为 0(也可以是 NA 或者其他值)
LBsR$reverse.VariablesIBX <- 1
LBsR$reverse.VariablesIBY <- 1

# 3. 对于那些 (Xx, aaa.variable1) 字符串用 "#" 连接后
#    恰好出现在 reverse_pairs 向量里的行,赋值为 -1
LBsR$reverse.VariablesIBX[
  paste(LBsR$aaa.analysisvariable1, LBsR$aaa.variable1, sep = "#") %in% reverse_pairs_IB
] <- -1

LBsR$reverse.VariablesIBY[
  paste(LBsR$aaa.analysisvariable2, LBsR$aaa.variable2, sep = "#") %in% reverse_pairs_IB
] <- -1

4 2nd Meta-Analysis Function

library(metafor) # standard meta-analyses
library(xlsx)
library(stringr)
library(robumeta) # package for RVE meta-analyses
library(clubSandwich)
SOOutput <- function(data, NewVariables = NULL, Order = "", title = "", 
                     TName = FALSE, note = FALSE, Cnote = FALSE, digits = FALSE) {
  
  # 输出中文说明(可选)
  if (Cnote) {
    instructionText_cn <- "SOOutput() 函数用于提取二阶元分析结果,并整理为一个数据表。
主要提取的变量包括:
  - XCategory, YCategory:构建变量
  - Nmeta:元分析中包含的研究数量
  - sumk:效应量总数
  - sumN:样本量总和
  - C6_Mean.R, C6_SE:效应量及其标准误
  - CI.LL, CI.UL:95%置信区间下、上限
  - CV.LL, CV.UL:信用区间下、上限
  - C7_Sampling.Error.Variance:抽样误差方差
  - C8_Total.Variance:总方差
  - C9_True.Variance:真实方差
  - C10_Prop.of.Error.Variance:误差方差所占比例
  - C11_Reliability:可靠性指标

额外参数:
  - NewVariables:可额外增加的变量
  - Order:指定排序列(例如 '-sumk' 表示降序排序)
  - title:输出表格标题
  - TName:是否将变量重命名为更直观的名称
  - digits:如果为 TRUE,则除“XCategory”和“YCategory”外的数值列保留3位小数且不采用科学计数法;为 FALSE 时保持原样。"
    wrapTextForChinese(instructionText_cn, maxWidth = 55)
  }
  
  # 输出英文说明(可选)
  if (note) {
    instructionText_en <- "SOOutput() is an R function for extracting and organizing second-order meta-analysis results.
It extracts the following variables:
  XCategory, YCategory, Nmeta, sumk, sumN,
  C6_Mean.R, C6_SE, CI.LL, CI.UL, CV.LL, CV.UL,
  C7_Sampling.Error.Variance, C8_Total.Variance, C9_True.Variance,
  C10_Prop.of.Error.Variance, C11_Reliability.
Additional parameters:
  - NewVariables: Optional additional variables to include.
  - Order: Specifies the sorting column (e.g., '-sumk' for descending order).
  - title: Title for the output table.
  - TName: If TRUE, renames the output columns to more intuitive names.
  - digits: If TRUE, all numeric columns (except XCategory and YCategory) will be rounded to 3 decimal places and displayed in fixed notation; if FALSE, they remain unchanged."
    wrapText(instructionText_en, width = 80)
  }
  
  # 定义默认需要提取的变量
  default_vars <- c("XCategory", "YCategory", "Nmeta", "sumk", "sumN",
                    "C6_Mean R", "C6_SE", "CI.LL", "CI.UL", "CV.LL", "CV.UL",
                    "C7_Sampling Error Variance", "C8_Total Variance", "C9_True Variance",
                    "C10_Prop of Error Variance", "C11_Reliability")
  
  # 合并额外变量(如果有的话)
  if (!is.null(NewVariables)) {
    selected_vars <- c(default_vars, NewVariables)
  } else {
    selected_vars <- default_vars
  }
  
  # 确保数据为 data.table 格式
  data <- as.data.table(data)
  
  # 检查所需列是否存在,缺失则警告并移除
  missing_vars <- setdiff(selected_vars, names(data))
  if (length(missing_vars) > 0) {
    warning("以下变量在数据中未找到,将被移除: ", paste(missing_vars, collapse = ", "))
    selected_vars <- intersect(selected_vars, names(data))
  }
  
  # 若没有任何有效的列,则停止运行
  if (length(selected_vars) == 0) {
    stop("没有找到任何有效的列,请检查输入数据和NewVariables参数。")
  }
  
  # 提取所需变量构建输出表
  OutputTable <- data[, ..selected_vars]
  
  # 自动转换所有列为数值型,除了 "XCategory" 和 "YCategory"
  for (col in names(OutputTable)) {
    if (!(col %in% c("XCategory", "YCategory"))) {
      OutputTable[[col]] <- suppressWarnings(as.numeric(OutputTable[[col]]))
    }
  }
  
  # 根据 Order 参数进行排序(支持负号表示降序)
  if (nzchar(Order)) {
    order_col <- gsub("^-", "", Order)   # 去除负号
    if (!(order_col %in% names(OutputTable))) {
      warning("排序列 ", order_col, " 不存在于输出表中,跳过排序。")
    } else {
      order_desc <- grepl("^-", Order)  # 检查是否降序
      setorderv(OutputTable, cols = order_col, order = if (order_desc) -1 else 1)
    }
  }
  
  # 根据 TName 参数重命名输出列为更直观的名称
  if (TName) {
    rename_map <- list(
      "XCategory" = "X Category",
      "YCategory" = "Y Category",
      "Nmeta" = "Number of Studies",
      "sumk" = "Total k",
      "sumN" = "Total N",
      "C6_Mean.R" = "Mean R",
      "C6_SE" = "SE",
      "CI.LL" = "CI Lower",
      "CI.UL" = "CI Upper",
      "CV.LL" = "CV Lower",
      "CV.UL" = "CV Upper",
      "C7_Sampling.Error.Variance" = "Sampling Error Var",
      "C8_Total.Variance" = "Total Var",
      "C9_True.Variance" = "True Var",
      "C10_Prop.of.Error.Variance" = "Prop. Error Var",
      "C11_Reliability" = "Reliability"
    )
    common_names <- intersect(names(rename_map), names(OutputTable))
    setnames(OutputTable, old = common_names, new = unlist(rename_map[common_names]))
  }
  
  # 当 digits 为 TRUE 时,对数值型列(除 XCategory 和 YCategory 外)进行 round() 四舍五入至3位小数,
  # 返回的依然是数值型的 data.table(如需避免科学计数法显示,可在外部设置 options(scipen = 999))
  if (digits) {
    numeric_cols <- names(OutputTable)[sapply(OutputTable, is.numeric)]
    if (length(numeric_cols) > 0) {
      OutputTable[, (numeric_cols) := lapply(.SD, round, 3), .SDcols = numeric_cols]
    }
  }
  
  # 如果指定了标题并且存在打印函数,则打印输出表格
  if (nzchar(title) && exists("print_table")) {
    print_table(OutputTable, title = title)
  }
  
  # 强制确保返回对象为 data.table
  setDT(OutputTable)
  return(OutputTable)
}
###A. Print Chinese text for notes


wrapTextForChinese <- function(text, maxWidth = 40) {
  # PURPOSE: This function is used to bring the Chinese text when knit rmd for html format.
  #EXAMPLE: For illustrative example, please refer to the section 1.3.6 and 2.2.2 of 'Auto.Me Illustration' file in this link: https://rpubs.com/EasonZhang.
  lines <- unlist(strsplit(text, split = "\n"))  # 首先按原有换行符分割文本
  wrappedLines <- c()

  for (line in lines) {
    while (nchar(line, type = "width") > maxWidth) {
      # 查找在 maxWidth 限制内的最后一个可能的断行点
      breakPosition <- maxWidth
      if (grepl("!", substr(line, 1, maxWidth))) {
        # 如果在当前行的前maxWidth个字符中存在"!",找到最后一个"!"的位置作为断行点
        breakPosition <- max(unlist(gregexpr("!", substr(line, 1, maxWidth))))
      }
      # 添加当前断行点之前的文本到wrappedLines
      wrappedLines <- c(wrappedLines, substr(line, 1, breakPosition))
      # 移除已经添加的部分
      line <- substr(line, breakPosition + 1, nchar(line))
    }
    # 添加剩余的部分(如果有)
    if (nchar(line) > 0) {
      wrappedLines <- c(wrappedLines, line)
    }
  }

  # 使用cat打印最终结果
  cat(paste(wrappedLines, collapse = "\n"))
}




wrapText <- function(text, width = 80) {
  # PURPOSE: This function is used to bring the English text when knit rmd for html format.
  #EXAMPLE: For illustrative example, please refer to the section 1.3.6 and 2.2.2 of 'Auto.Me Illustration' file in this link: https://rpubs.com/EasonZhang.
  words <- unlist(strsplit(text, split = " "))  # 将文本拆分为单词
  wrappedText <- ""
  currentLineLength <- 0

  for (word in words) {
    # 检查添加当前单词是否会超过宽度限制
    if (currentLineLength + nchar(word, type="width") <= width) {
      # 当前行添加单词
      wrappedText <- ifelse(currentLineLength > 0, paste0(wrappedText, " ", word), paste0(wrappedText, word))
      currentLineLength <- currentLineLength + nchar(word, type="width") + 1  # 加1因为空格
    } else {
      # 超过宽度限制,从新行开始
      wrappedText <- paste0(wrappedText, "\n", word)
      currentLineLength <- nchar(word, type="width")
    }
  }

  cat(wrappedText)
}

trim.author <- function(author.v) {
  author.v <- sub(",.*", " et al.", author.v)
  author.v <- sub(",.*", " et al.", author.v)
  save.id <- grep("De", author.v)
  author.sv <- author.v[save.id]
  author.v <- gsub("
                  .*$", "", author.v)
  author.v[save.id] <- author.sv
  return(author.v)
}

# trim.metaid <- function(idv){
# idv = sub('\\(.*','',idv)
#  idv = sub('(.*','',idv)
#  idv = sub('_','',idv)
#  return(as.numeric(idv))
# }

trim.metaid <- function(idv) {
  idv <- sub("\\(.*", "", idv)
  idv <- sub("(.*", "", idv)
  idv <- sub("_", "", idv)
  # 如果字符串中包含字母,比如OB中"Liang2022",则替换成 "20252022"
  idv <- ifelse(grepl("Liang2022", idv), "20252022", idv)
  # 如果字符串中包含字母,比如IB中"LiuJOM",则替换成 "20252023"
  idv <- ifelse(grepl("LiuJOM", idv), "20252023", idv)
  return(as.numeric(idv))
}


LabChange <- function(labM, labv) {
  nr <- nrow(labM)
  labv.new <- labv
  for (i in 1:nr) {
    labv.new[labv.new == labM[i, 1]] <- labM[i, 2]
  }
  return(labv.new)
}

myrma.des <- function(yi, vi, sid, method = "MLM", tau2 = NULL) {
  # method: MLM or RVE
  del.tmp <- which(is.na(yi) == T)
  nna <- length(del.tmp)
  if (nna > 0 && nna < length(yi)) {
    yi <- yi[-del.tmp]
    vi <- vi[-del.tmp]
    sid <- sid[-del.tmp]
  }

  nes <- length(yi) # number of effect sizes.  有多少个效应量
  nmeta <- length(unique(sid)) # number of 1st-order meta  有多少个元分析
  esid <- 1:length(sid) # effect size id  效应量的id,从1到nmeta,有多少个元分析有多少效应量
  dat.tmp <- data.frame(yi = yi, vi = vi, sid = sid) # 效应量 yi、对应的抽样方差 vi 以及研究标识符 sid合并成一个数据框
  fit <- list(yi = yi, vi = vi)
  if (nmeta == 1) { # All effect sizes are from one meta-analysis
    # RVE
    fit.rve <- try(robu(
      formula = yi ~ 1, data = dat.tmp,
      studynum = sid, var.eff.size = vi,
      modelweights = "CORR", small = TRUE
    )) # 使用稳健方差估计
    if (inherits(fit.rve, "try-error")) {
      fit <- list(
        b = NA, se = NA, sigma2 = NA, se.tau2 = NA, ci.lb = NA, ci.ub = NA,
        k = nes, vi = rep(NA, nes)
      )
    } else {
      fit$b <- fit.rve$reg_table$b.r # 总体平均效应量
      fit$se <- fit.rve$reg_table$SE # 总体平均效应量的标准误
      fit$sigma2 <- fit.rve$mod_info$tau.sq # 模型提供的 tau² 值(即异质性指标)
      fit$se.tau2 <- NA # 总体效应量方差的标准误?
      fit$ci.lb <- fit.rve$reg_table$CI.L # 总体平均效应量的置信区间下限
      fit$ci.ub <- fit.rve$reg_table$CI.U # 总体平均效应量的置信区间上限
      fit$k <- fit.rve$k # 元分析的个数,效应量数
    }
  } else {
    if (nmeta == nes) { # no dependent effect sizes
      fit <- try(rma(yi = yi, vi = vi))
      if (inherits(fit, "try-error")) { # 如果 rma 函数拟合出错,则将 fit 赋值为一个包含关键统计量均为 NA 的列表
        fit <- list(b = NA, se = NA, sigma2 = NA, se.tau2 = NA, ci.lb = NA, ci.ub = NA)
      } else {
        fit$sigma2 <- fit$tau2
      }
    } else { # With dependent effect sizes
      if (method == "RVE") { # robust variance estimation
        fit.rve <- try(robu(
          formula = yi ~ 1, data = dat.tmp,
          studynum = sid, var.eff.size = vi,
          modelweights = "CORR", small = TRUE
        ))
        if (inherits(fit, "try-error")) {
          fit <- list(
            b = NA, se = NA, sigma2 = NA, se.tau2 = NA, ci.lb = NA, ci.ub = NA,
            k = nes, vi = rep(NA, nes)
          )
        } else {
          fit$b <- fit.rve$reg_table$b.r
          fit$se <- fit.rve$reg_table$SE
          fit$sigma2 <- fit.rve$mod_info$tau.sq
          fit$se.tau2 <- NA
          fit$ci.lb <- fit.rve$reg_table$CI.L
          fit$ci.ub <- fit.rve$reg_table$CI.U
          fit$k <- fit.rve$k
        }
      } else if (method == "MLM") {
        if(length(yi) <= 1){
          # 当只有一个效应量时,直接构造结果
          fit <- list(
            b = yi, 
            se = sqrt(vi), 
            sigma2 = NA,           # 无法估计异质性
            se.tau2 = NA,
            ci.lb = yi - 1.96 * sqrt(vi),
            ci.ub = yi + 1.96 * sqrt(vi),
            k = 1,
            vi = vi,
            nmeta = nmeta
          )
        } else {
          fit.mlm <- try(rma.mv(yi = yi, V = vi,
                                random = list(~1 | sid, ~1 | esid),# 考虑两层随机效应——一个是基于研究编号(sid),另一个是基于效应量的编号(esid)
                                cvvc = TRUE))
          if(inherits(fit.mlm, 'try-error')) { 
            fit <- list(b = NA, se = NA, sigma2 = rep(NA, 2),
                        ci.lb = NA, ci.ub = NA, k = nes, vi = rep(NA, nes))
          } else {
            fit <- fit.mlm
          }
        }
      }
    }
  }
  
  fit$nmeta <- nmeta
  return(fit)
}

# Organize results
# i.e., return the 6th-11th columns in Table 2 in Schmidt paper
meta2nd.Table2SO <- function(fit, K, NK, nmeta2) {
  # fit: an rma object
  # meta2.d: data for the 2nd order meta-analysis
  #          rbar: 1st order meta-analytic correlations
  #          vi: sampling variances of rbar
  #          rel: study reliability (sqrt(rxx*ryy) or rbar/rhobar)
  # K: number of effect sizes within 1st order meta-analyses
  # NK: Total number of participants within 1st order meta-analyses
  if (is.null(fit$nmeta)) {
    nmeta <- nmeta2
  } else {
    nmeta <- fit$nmeta
  }

  nes <- length(K) # number of effect sizes
  if (is.null(fit$k)) {
    nes.used <- 0
  } else {
    nes.used <- fit$k
  }

  # 如果多效应量情况,确保必需字段存在
  # if (nes.used > 1) {
  #   if (is.null(fit$vi)) fit$vi <- rep(NA_real_, nes)
  #   if (is.null(fit$yi)) fit$yi <- rep(NA_real_, nes)
  #   if (is.null(fit$b)) fit$b <- NA_real_
  #   if (is.null(fit$se)) fit$se <- NA_real_
  #   if (is.null(fit$ci.lb)) fit$ci.lb <- NA_real_
  #   if (is.null(fit$ci.ub)) fit$ci.ub <- NA_real_
  # } else {
  #   if (is.null(fit$rbar)) fit$rbar <- NA_real_
  #   if (is.null(fit$vi)) fit$vi <- NA_real_
  #   if (is.null(fit$sigma2)) fit$sigma2 <- NA_real_
  # }

  if (nes.used > 1) {
    ## Compute Second order sampling error: ESr2
    wi <- 1 / fit$vi # weight for each first order meta-analysis
    rbar.1st <- fit$yi

    # 1st order meta-analyses with missing values
    se.tau2 <- se.tau2.1.2nd <- se.tau2.2.2nd <- NA
    if (is.null(fit$se.tau2) == 0) {
      se.tau2 <- fit$se.tau2
    }
    del2 <- unique(which(is.na(cbind(rbar.1st, fit$vi)), arr.ind = T)[, 1])
    if (length(del2) == nes) { # 如果所有一阶元分析都有缺失则都为NA
      rbar.2nd <- ESr2 <- tau2.2nd <- tau2.1.2nd <- tau2.2.2nd <- NA
      Srbar2 <- ProVar <- rel <- NA
      CI95 <- CV80 <- rep(NA, 2)
    } else {
      if (length(del2) > 0) {
        ESr2 <- length(wi[-del2]) / sum(wi[-del2]) # 有缺失的,用未缺失部分计算
      } else {
        ESr2 <- length(wi) / sum(wi)
      } # Eq.6e 二阶抽样误差方差:m/sum(wi)  m为权重个数
      rbar.2nd <- fit$b[1] # estimated population mean correlation
      if (length(fit$sigma2) == 2) {
        tau2.1.2nd <- fit$sigma2[1] # between-meta variance
        tau2.2.2nd <- fit$sigma2[2] # within-meta variance
        tau2.2nd <- sum(fit$sigma2) # total between-effect-size variance
        if ((sum(is.na(fit$vvc)) == 0) && (nrow(fit$vvc) == 2)) {
          se.tau2 <- as.numeric(sqrt(t(c(1, 1)) %*% fit$vvc %*% c(1, 1)))
          se.tau2.1.2nd <- sqrt(fit$vvc[1, 1])
          se.tau2.2.2nd <- sqrt(fit$vvc[2, 2])
        }
      } else {
        tau2.2nd <- fit$sigma2
        tau2.1.2nd <- tau2.2.2nd <- NA
      }
      CI95 <- c(fit$ci.lb, fit$ci.ub)
      CV80 <- c(
        rbar.2nd - qnorm(.90) * sqrt(tau2.2nd),
        rbar.2nd + qnorm(.90) * sqrt(tau2.2nd)
      )
      Srbar2 <- ESr2 + tau2.2nd
      ProVar <- ESr2 / Srbar2
      rel <- 1 - ProVar
    }
    res6_11 <- c(
      nmeta, nes, nes.used, sum(K, na.rm = T), sum(NK, na.rm = T), rbar.2nd,
      fit$se, CI95, CV80, ESr2, Srbar2, tau2.2nd, se.tau2, tau2.2.2nd, tau2.1.2nd,
      se.tau2.1.2nd, se.tau2.2.2nd, ProVar, rel
    )
  } else {
    print("nes.used <= 1, 1st order meta-analyses are not used.")
    # rbar 取 fit$rbar 或 fit$b
    if (!is.null(fit$rbar) && !is.na(fit$rbar)) {
      rbar <- fit$rbar
    } else if (!is.null(fit$b) && !is.na(fit$b)) {
      rbar <- fit$b
    } else {
      rbar <- NA
      warning("fit$rbar and fit$b are both missing.")
    }
    # rbar.se 取 sqrt(fit$vi) 或 sqrt(fit$se)
    if (!is.null(fit$vi) && length(fit$vi) > 0 && !any(is.na(fit$vi))) {
      rbar.se <- sqrt(fit$vi)
    } else if (!is.null(fit$se) && length(fit$se) > 0 && !any(is.na(fit$se))) {
      rbar.se <- sqrt(fit$se)
    } else {
      rbar.se <- NA
      warning("fit$vi and fit$se are both missing.")
    }
    tau2 <- fit$sigma2
    CI95 <- c(rbar - 1.96 * rbar.se, rbar + 1.96 * rbar.se) # Handbook p.206
    if (nes > 1) {
      K <- sum(K, na.rm = T)
      NK <- sum(NK, na.rm = T)
    }

    if (!is.null(fit$vi) && length(fit$vi) > 0) {
      Sr2 <- fit$vi * K
    } else if (!is.null(fit$se) && length(fit$se) > 0) {
      Sr2 <- (fit$se^2) * K
    } else {
      warning("Both fit$vi and fit$se are missing or empty.")
    }

    Srbar2 <- Sr2 + tau2
    ProVar <- Sr2 / Srbar2
    rel <- 1 - ProVar
    CV80 <- c(rbar - qnorm(.90) * sqrt(tau2), rbar + qnorm(.90) * sqrt(tau2))
    res6_11 <- c(
      nmeta, nes, nes.used, K, NK, rbar, rbar.se, CI95, CV80, Sr2, Srbar2, tau2,
      NA, NA, NA, NA, NA, ProVar, rel
    )
  }
  return(res6_11)
}

DiffTest <- function(est, se) {
  d <- est[1] - est[2]
  sed <- sqrt(sum(se^2))
  zd <- abs(d / sed)
  pvalue <- 2 * (1 - pnorm(zd))
  return(c(d, sed, zd, pvalue))
}

5 Data preparation

5.1 Sample sizes and the indexing matrix

# 清理格式
LBsR$aaa.k <- as.numeric(gsub("[,,]", "", LBsR$aaa.k))
LBsR$hocorrected.t[grepl("原文说用的是HS, 这个Q不知道放那", LBsR$hocorrected.t)] <- NA


# split the data into two parts

data <- LBsR[relation %in% c("OB", "IBOB.o")]

#data <- LBsR[relation %in% c("IB", "IBOB")]

5.2 Data preparation for OB/IB

# Data preparation
## Sample sizes and the indexing matrix
NK <- as.numeric(data$N) # 1st order meta-analyses 中的参与者总数
K <- as.numeric(data$aaa.k) # 1st order meta-analyses 中的效应大小数量
Nbar <- NK / K # 每个原始研究的平均参与者数量
Nmeta <- length(NK) # 1st order meta-analyses 的数量

# Replace missing within-study sample sizes with the median Nbar
median.Nbar <- median(Nbar, na.rm = TRUE) # 计算 Nbar 的中位数(忽略缺失值)
median.K <- median(K, na.rm = TRUE) # 计算 K 的中位数(忽略缺失值)
NK[is.na(Nbar)] <- median.Nbar * K[is.na(Nbar)] # 对于 Nbar 缺失的样本,用中位数 Nbar 乘以对应的 K 替换 NK
NK[is.na(NK)] <- median.Nbar * median.K # 对于 NK 仍缺失的值,用中位数 Nbar 与中位数 K 的乘积替换
Nbar[is.na(Nbar)] <- median.Nbar # 用中位数 Nbar 替换 Nbar 中缺失的值
K[is.na(K)] <- median.K # 用中位数 K 替换 K 中缺失的值

indM <- matrix(1, Nmeta, 6)
colnames(indM) <- c("ind.rbar", "ind.rhobar", "ind.Sr2", "ind.Src2", "ind.tau2.r", "ind.tau2.rho")

# rbar: Meta-analytic mean correlation (raw)
#   1: HS average correlation   1: HS 平均相关系数
#   2: HO average correlation    2: HO 平均相关系数
#   3: mid point of the prediction interval  3: 预测区间的中点
#   4: no results
# rhobar: Meta-analytic mean correlation (With unreliability correction)
#   1: HS average correlation
#   2: sample size weighted average correlation  2: 样本大小加权平均相关系数
#   3: no results
#   4: rbar and rhobar have different signs  rbar 和 rhobar 的符号不同
#   5: rhobar is smaller than its rbar  rhobar 小于其 rbar
# Sr2: Total variance of the observed correlations  Sr2:观察到的相关系数的总方差
# Without unreliability correction
#   1: Directly report total。 1:直接报告总数
#   2: Compute total variance from Q/NK  2:从 Q/NK 计算观察到的总方差
#   3: Total Variance = Average Sampling Variance + Heterogeneity  3:总方差=平均抽样方差+异质性
#   4: Total Variance = Average Sampling Variance/(1-Percentage)。 4:总方差=平均抽样方差/(1-百分比)
#   5: Reported total variance smaller than Average Sampling variance (<0)
#   6: Computed Sr2 greater than 1
#   7: Computed Sr2 from Src2
#   8: Total Variance = Average Sampling Variance + Heterogeneity (Imputed)
# With unreliability correction
#   1: Directly report with unreliability correction 1:直接报告带有不可靠性校正的值
#   2: Compute total variance from Q/NK  2:从 Q/NK 计算观察到的总方差
#   3: Total Variance = Average Sampling Variance + Heterogeneity
#   4: Total Variance = Average Sampling Variance/(1-Percentage)
#   5: Reported total variance smaller than Average Sampling variance
#   6: Computed Src2 greater than 1
#   7: Compute Src2 from Sr2
#   8: Total Variance = Average Sampling Variance + Heterogeneity (Imputed)
# tau2.r:
#   1: Directly report tau2
#   2: Tau2 computed based on credibility intervals 2:基于可信区间计算的 tau2
#   3: Tau2 computed based on the formula: Total Var-Average Error Var 3:基于公式计算的 tau2:总方差-平均误差方差
#   4: Tau2 imputed using 0.0144  4:使用 0.0144 补充的 tau2
# tau2.rho (with unreliability correction):
#   1: Directly report tau2
#   2: Tau2 computed based on credibility intervals
#   3: Tau2 computed based on the formula: Total Var-Average Error Var
#   4: Tau2 imputed using 0.0144

5.3 Mean correlations

5.3.1 Raw correlations

# Meta-analytic mean correlation (raw)
#--------------------------------------
# 1: HS average correlation
rbar <- data$aaa.hsraw.r
rbar <- as.numeric(rbar)
# 2: HO average correlation
indM[is.na(rbar), 1] <- 2
aaa.horaw.r <- as.numeric(data$aaa.horaw.r)
rbar[is.na(rbar)] <- aaa.horaw.r[is.na(rbar)]

# 3: mid point of the prediction interval
indM[is.na(rbar), 1] <- 3
rbar[is.na(rbar)] <- ((as.numeric(data$hsraw.10cv) + as.numeric(data$hsraw.90cv)) / 2)[is.na(rbar)]

# 4: no results
indM[is.na(rbar), 1] <- 4

5.3.2 Corrected correlations

# Meta-analytic mean correlation (With unreliability correction)
#-----------------------------------------------------------------

# 1: HS average correlation
if (!is.null(data$aaa.hscorrected.r)) {
  rhobar <- suppressWarnings(as.numeric(data$aaa.hscorrected.r))
} else {
  rhobar <- rep(NA, nrow(data))
}

# 2: HO average correlation
indM[is.na(rhobar), 2] <- 2
if (!is.null(data$aaa.hocorrected.r)) {
  hocorr <- suppressWarnings(as.numeric(data$aaa.hocorrected.r))
  rhobar[is.na(rhobar)] <- hocorr[is.na(rhobar)]
}

# 3: no results
indM[is.na(rhobar), 2] <- 3

5.3.3 Missing correlations: Fill by assuming a reliability of 0.8

# 先将 rbar 和 rhobar 转换为字符型
# rbar <- as.character(rbar)
# rhobar <- as.character(rhobar)

# 替换 rbar 中包含 "<-0.1" 的值为 NA
rbar[grepl("<-0.1", rbar)] <- NA

# 替换 rhobar 中包含 "/" 的值为 NA
rhobar[grepl("/", rhobar)] <- NA

# 转换为数值型
rbar <- as.numeric(rbar)
rhobar <- as.numeric(rhobar)
# Missing data handling: assume a reliability, i.e., 0.8
# fill missing values with corresponding raw mean correlations
# --------------------------------------------------------------------------

rhobar[is.na(rhobar)] <- rbar[is.na(rhobar)] / 0.8
rhobar[which(rhobar > 1)] <- NA # 超过1的情况,置为NA
# fill missing values with corresponding corrected mean correlations
rbar[is.na(rbar)] <- rhobar[is.na(rbar)] * 0.8

# Reliability estimates for each 1st meta-analysis
# 计算 rbar/rhobar 或直接设为 0.8
# rbar/rhobar or set to 0.8
rel.meta <- rbar / rhobar
rel.meta[rhobar == 0] <- 0.8 # 当无法用 rbar/rhobar 估计时,设为 0.8
rel.meta[rbar == 0] <- 0.8 # 当无法用 rbar/rhobar 估计时,设为 0.8
rel.meta[is.na(rel.meta)] <- 0.8

# Data cleaning
# 对于可靠性不合理的研究,替换 rhobar
# 1. 当 rbar 与 rhobar 符号不一致时
sel <- which(rel.meta < 0) # 处理 rbar 和 rhobar 符号不一致
indM[sel, 2] <- 4
rhobar[sel] <- rbar[sel] / 0.8
rel.meta[sel] <- 0.8

# 2. 当 rhobar 小于对应的 rbar 时(计算出来的可靠性大于1)
# rhobar is smaller than its rbar
sel <- which(rel.meta > 1)
indM[sel, 2] <- 5
rhobar[sel] <- rbar[sel] / 0.8
rel.meta[sel] <- 0.8

# 3. 对于可靠性小于 0.6 的情况,直接设为 0.6,并重新计算 rhobar
# reliability smaller than 0.6 is set to 0.6
sel <- which(rel.meta < 0.6)
rel.meta[sel] <- 0.6
rhobar[sel] <- rbar[sel] / rel.meta[sel]

5.4 Heterogeneity: tau2

### tau2 of raw correlations
# tau2:  1 Directly report tau2
#-------------------------------------------------
tau2.r <- (data$hsraw.sdtrue)^2 # 使用原始数据中的标准差(平方得到变异数)
tau2.r[is.na(tau2.r)] <- data$hsraw.var.true[is.na(tau2.r)]
tau2.r[is.na(tau2.r)] <- (data$horaw.t^2)[is.na(tau2.r)]
tau2.r[is.na(tau2.r)] <- data$horaw.t2[is.na(tau2.r)]
tau2.r <- as.numeric(tau2.r)
# 2: Tau2 computed based on credibility intervals
#---------------------------------------------------------------
indM[is.na(tau2.r), 5] <- 2
# credibility level: 80%
UCV <- as.numeric(data$hsraw.90cv)
LCV <- as.numeric(data$hsraw.10cv)
CV <- (UCV - LCV) / 2 / qnorm(0.90) # 标准正态分布在 90% 分位处的值
tau2.r[is.na(tau2.r)] <- (CV[is.na(tau2.r)])^2

5.4.1 tau2 of corrected correlations

data$hocorrected.t <- as.numeric(data$hocorrected.t)
data$hocorrected.t2 <- as.numeric(data$hocorrected.t2)
data$hscorrected.sdtrue <- as.numeric(data$hscorrected.sdtrue)
#  tau2: 1 Directly report tau2
#-----------------------------------------------------------------------
if ((is.null(data$aaa.hscorrected.r) == F) | (is.null(data$aaa.hocorrected.r) == F)) {
  tau2.rho <- (data$hscorrected.sdtrue)^2 # Heterogeneity based on HS corrected SD
  tau2.rho[is.na(tau2.rho)] <- data$hscorrected.var.true[is.na(tau2.rho)]

  # 如果 HO 校正的 T2 值存在,则使用它填补缺失
  if (!is.null(data$hocorrected.t2)) {
    tau2.rho[is.na(tau2.rho)] <- data$hocorrected.t2[is.na(tau2.rho)]
  }
  # 如果 HO 校正的 T 值存在,则使用其平方填补缺失
  if (!is.null(data$hocorrected.t)) {
    tau2.rho[is.na(tau2.rho)] <- (data$hocorrected.t^2)[is.na(tau2.rho)]
  }

  # Tau2: 2 Tau2 computed based on credibility intervals
  #----------------------------------------------------------------------
  indM[is.na(tau2.rho), 6] <- 2
  # credibility level: 80%
  UCV <- as.numeric(data$hscorrected.90cv)
  LCV <- as.numeric(data$hscorrected.10cv)
  CV <- (UCV - LCV) / 2 / qnorm(0.90)
  tau2.rho[is.na(tau2.rho)] <- (CV[is.na(tau2.rho)])^2
} else {
  tau2.rho <- rep(NA, nrow(data))
}

5.4.2 Missing tau2: fill by assuming a reliability of 0.8

tau2.r <- as.numeric(tau2.r)
tau2.rho <- as.numeric(tau2.rho)
rel.meta <- as.numeric(rel.meta)

tau2.rho[is.na(tau2.rho)] <- tau2.r[is.na(tau2.rho)] / (rel.meta[is.na(tau2.rho)]^2)
tau2.r[is.na(tau2.r)] <- tau2.rho[is.na(tau2.r)] * (rel.meta[is.na(tau2.r)]^2)

5.5 Total variance of observed correlations Sr2

5.5.1 Total variance of raw observed correlations

## Total variance of observed correlations Sr2
### Total variance of raw observed correlations

# Sr2: 1 Directly report
#------------------------------------------------------------------------
Sr2 <- (data$hsraw.sdcorr)^2
# 如果 hsraw.var.obs.total 不为空,则用它填补 Sr2 中的 NA
if (!is.null(data$hsraw.var.obs.total)) {
  Sr2[is.na(Sr2)] <- data$hsraw.var.obs.total[is.na(Sr2)]
}

# Sr2: 2 Compute total variance from Q/NK
#-------------------------------------------------------------------------
indM[is.na(Sr2), 3] <- 2
Q <- as.numeric(data$horaw.q)
Sr2.tmp <- (Q - (K - 1)) / (NK - NK / K) # Handbook p.271 Equ. 14.23
Sr2.tmp[Sr2.tmp < 0] <- NA
Sr2[is.na(Sr2)] <- Sr2.tmp[is.na(Sr2)]

# Sr2: 3 Total Variance = Average Sampling Variance + Heterogeneity
#-------------------------------------------------------------------------
indM[is.na(Sr2), 3] <- 3

# Average Sampling Variance (参考 Hunter & Schmidt p.101)
# 这里的 rbar、Nbar 需要在前面代码里已正确计算
AveSig2e <- ((1 - rbar^2)^2) / (Nbar - 1)

# 如果上一步失败或 NA,可以使用 hsraw.sdartifact 的平方
Sig2e <- (data$hsraw.sdartifact)^2
AveSig2e[is.na(AveSig2e)] <- Sig2e[is.na(AveSig2e)]
# 如果依旧是 NA,可以使用 hsraw.var.error
AveSig2e[is.na(AveSig2e)] <- data$hsraw.var.error[is.na(AveSig2e)]
# 去除小于 0 的异常值
AveSig2e[AveSig2e < 0] <- NA

AveSig2e <- as.numeric(AveSig2e)
tau2.r <- as.numeric(tau2.r)


# 计算总方差 = 平均抽样方差 + 异质性方差
TotVar <- AveSig2e + tau2.r
Sr2[is.na(Sr2)] <- TotVar[is.na(Sr2)]

# Sr2: 4 Total Variance = Average Sampling Variance/(1 - Percentage)
#-------------------------------------------------------------------------
indM[is.na(Sr2), 4] <- 4
Sr2[is.na(Sr2)] <- (AveSig2e / (1 - data$horaw.i2))[is.na(Sr2)]

# Sr2: 5 Reported total variance smaller than Average Sampling variance
#-------------------------------------------------------------------------
Sr2 <- as.numeric(Sr2)
indM[which(Sr2 - AveSig2e < 0), 3] <- 5
Sr2[which(Sr2 - AveSig2e < 0)] <- NA
Sr2[Sr2 < 0] <- NA

# Sr2: 6 Computed Sr2 greater than 1
#-------------------------------------------------------------------------
indM[which(Sr2 > 1), 3] <- 6
Sr2[which(Sr2 > 1)] <- NA

5.5.2 Total variance of corrected observed correlations

if ((is.null(data$aaa.hscorrected.r) == F) | (is.null(data$aaa.hocorrected.r) == F)) {
  # 1: Directly report
  #-------------------------------------------------------------------------
  Src2 <- (data$hscorrected.sdcorr)^2
  if (is.null(data$hscorrected.var.obs.total) == F) {
    Src2[is.na(Src2)] <- data$hscorrected.var.obs.total[is.na(Src2)]
  }

  # 2: Compute total variance from Q/NK
  #-------------------------------------------------------------------------
  indM[is.na(Src2), 4] <- 2
  Q <- data$hocorrected.q
  Src2.tmp <- ((Q - (K - 1)) / (NK - NK / K)) # Handbook p.271 Equ. 14.23
  Src2.tmp[Src2.tmp < 0] <- NA
  Src2[is.na(Src2)] <- Src2.tmp[is.na(Src2)]

  # 3: Total Variance = Average Sampling Variance + Heterogeneity
  #-------------------------------------------------------------------------
  indM[is.na(Src2), 4] <- 3
  AveSig2e.rho <- ((1 - rbar^2)^2) / (Nbar - 1) / (rel.meta^2) # Hunter & Schmidt p.144
  AveSig2e.rho[is.na(AveSig2e.rho)] <- ((data$hscorrected.sdartifact)^2)[is.na(AveSig2e.rho)]
  if (is.null(data$hscorrected.varerror) == F) {
    AveSig2e.rho[is.na(AveSig2e.rho)] <- data$hscorrected.varerror[is.na(AveSig2e.rho)]
  }
  AveSig2e.rho[which(AveSig2e.rho < 0)] <- NA

  TotVar.rho <- AveSig2e.rho + tau2.rho
  Src2[is.na(Src2)] <- TotVar.rho[is.na(Src2)]

  # 4: Total Variance = Average Sampling Variance/(1 - Percentage)
  #-------------------------------------------------------------------------
  indM[is.na(Src2), 4] <- 4
  Src2[is.na(Src2)] <- (AveSig2e.rho / (1 - data$hocorrected.i2))[is.na(Src2)]

  # 5: Reported total variance smaller than Average Sampling variance
  #-------------------------------------------------------------------------
  indM[which(Src2 - AveSig2e.rho < 0), 4] <- 5
  Src2[Src2 - AveSig2e.rho < 0] <- NA
  Src2[Src2 < 0] <- NA

  # 6: Computed Src2 greater than 1
  #-------------------------------------------------------------------------
  indM[which(Src2 > 1), 4] <- 6
  Src2[which(Src2 > 1)] <- NA
} else {
  Src2 <- AveSig2e.rho <- rep(NA, nrow(data))
}

5.5.3 Missing Src2: fill by assuming a reliability of 0.8

# Missing data handling: assume a high reliability, i.e., 0.8

# 7: Computed Src2 from Sr2
indM[is.na(Src2), 4] <- 7
Src2[is.na(Src2)] <- Sr2[is.na(Src2)] / (rel.meta[is.na(Src2)]^2)

# 8: Computed Sr2 from Src2
indM[is.na(Sr2), 3] <- 7
Sr2[is.na(Sr2)] <- Src2[is.na(Sr2)] * (rel.meta[is.na(Sr2)]^2)

5.6 Clean data and assemble the data for 2nd order meta-analyses

5.6.1 Impute missing heterogeneity

# Method 1: tau2 = Total Variance - Average Error Variance
#-------------------------------------------------------------------------
# Raw correlations
tau2.r.f <- tau2.r
indM[is.na(tau2.r), 5] <- 3
tau2.r.f[is.na(tau2.r.f)] <- Sr2[is.na(tau2.r.f)] - AveSig2e[is.na(tau2.r.f)]
tau2.r.f[tau2.r.f == 0] <- NA
tau2.r.f[(Sr2 - tau2.r.f) == 0] <- NA
# tau2.r.f[tau2.r.f > 1] = NA  # 如果tau2超过1,可按需要置为NA

# Corrected correlations
tau2.rho.f <- tau2.rho
indM[is.na(tau2.rho), 6] <- 3
tau2.rho.f[is.na(tau2.rho.f)] <- Src2[is.na(tau2.rho.f)] - AveSig2e.rho[is.na(tau2.rho.f)]
# tau2.rho.f[tau2.rho.f < 0] = NA
tau2.rho.f[tau2.rho.f == 0] <- NA
tau2.rho.f[tau2.rho.f > 1] <- NA

# Method 2: tau2 = 0.0144 from a large meta-analysis on heterogeneity in psychological research
# Method 2: 采用0.0144(来源于心理学领域大规模meta分析的异质性估计)
#-------------------------------------------------------------------------
# Raw correlations
# indM[is.na(tau2.r.f), 5] = 4
# tau2.r.f[is.na(tau2.r.f)] = 0.0144
# Corrected correlations
# indM[is.na(tau2.rho.f), 6] = 4
# tau2.rho.f[is.na(tau2.rho.f)] = 0.0144

5.6.2 Impute missing total variances

# Total Variance = Average Sampling Variance + Heterogeneity (Imputed)

# Raw correlations
Sr2.f <- Sr2
indM[is.na(Sr2.f), 3] <- 8
TotVar <- AveSig2e + tau2.r.f
Sr2.f[is.na(Sr2.f)] <- TotVar[is.na(Sr2.f)]

# Corrected correlations
Src2.f <- Src2
indM[is.na(Src2.f), 4] <- 8
TotVar <- AveSig2e.rho + tau2.rho.f
Src2.f[is.na(Src2.f)] <- TotVar[is.na(Src2.f)]

5.6.3 Output data for the 2nd order meta-analyses

library(readxl)
library(data.table)

# 读取 Excel 文件中名为 "国商reference" 的 sheet
meta_coding <- as.data.table(read_excel("meta analysis coding.xlsx", sheet = "国商reference"))

data <- merge(data, 
              meta_coding[, .(aaa.articleid, Author, year)], 
              by = "aaa.articleid", 
              all.x = TRUE, 
              sort = FALSE)
# Reverse coding(OB)
data$reverse.VariablesOBX <- as.numeric(data$reverse.VariablesOBX)
data$reverse.VariablesOBY <- as.numeric(data$reverse.VariablesOBY)

# 第二步:将 rbar、rhobar 分别乘以这两个数值
rbar   <- rbar   * data$reverse.VariablesOBX * data$reverse.VariablesOBY
rhobar <- rhobar * data$reverse.VariablesOBX * data$reverse.VariablesOBY

# # Reverse coding(IB)
# data$reverse.VariablesIBX <- as.numeric(data$reverse.VariablesIBX)
# data$reverse.VariablesIBY <- as.numeric(data$reverse.VariablesIBY)
# 
# # 第二步:将 rbar、rhobar 分别乘以这两个数值
# rbar   <- rbar   * data$reverse.VariablesIBX * data$reverse.VariablesIBY
# rhobar <- rhobar * data$reverse.VariablesIBX * data$reverse.VariablesIBY

meta.id <- trim.metaid(data$aaa.articleid) # 提取并排序 meta.id


# 先去除两边空格
data$Xx <- str_trim(data$Xx)
data$Yy <- str_trim(data$Yy)
# 将 "perception of support" 替换为 "perceptions of support"
data$Xx <- gsub("perceptions of support", "perception of support", data$Xx)
data$Yy <- gsub("perceptions of support", "perception of support", data$Yy)

# IB中需要替换的名称
columns_to_replace <- c("Xx", "Yy")


# 要替换的值和新值
values_to_replace <- c("financial outcome", "general performance", 
                       "innovation", "Innovation",
                       "internationalization", "Internationalization", 
                       "non-marketing outcome","marketing outcome","Organizational Outcome")
new_value <- "organizational outcome"

# 替换指定列中的值

data=data[, (columns_to_replace) := lapply(.SD, function(x) {
  ifelse(x %in% values_to_replace, new_value, x)
}), .SDcols = columns_to_replace]


factorX = data$aaa.variable1
factorY = data$aaa.variable2

# Xx 和 Yy 的所属的类别
XAnalysisCategory <- data$XX
YAnalysisCategory <- data$YY

#Author and Year

Author <- data$Author
Year <- data$year

# Extact and get order the X and Y categories
# 提取并排序 X 和 Y 的类别
XCategory <- data$Xx
XCategory <- str_trim(XCategory)
XCategory.names <- names(table(XCategory)) # X 类别中所有不重复的名称

YCategory <- data$Yy
YCategory <- str_trim(YCategory)
YCategory.names <- vector("list", length = length(XCategory.names))
names(YCategory.names) <- XCategory.names

for (i in 1:length(XCategory.names)) {
  sel <- which(XCategory == XCategory.names[i])
  YCategory.sub <- YCategory[sel]
  tmp <- names(table(YCategory.sub))
  YCategory.names[[i]] <- tmp
}
YCategory.names2 <- unique(unlist(YCategory.names))

# 计算置信区间(H&S book p.230,标准误设置为 sqrt(Src2.f/K))
CI95_LL <- rhobar - 1.96 * sqrt(Src2.f / K)
CI95_UL <- rhobar + 1.96 * sqrt(Src2.f / K)

# 计算80%信用区间(基于 tau2.rho.f)
CR80_LL <- rhobar - qnorm(0.9) * sqrt(tau2.rho.f)
CR80_UL <- rhobar + qnorm(0.9) * sqrt(tau2.rho.f)

First.Meta <- data.frame(
  meta.id, # 由 trim.metaid(data$aaa.articleid) 得到
  Author, # 来自 data$Author
  Year, # 来自 data$Year
  # group,           # 来自 data$subgroup.country
  XCategory, # 来自 data$Xx(已 str_trim 处理)
  YCategory, # 来自 data$Yy(已 str_trim 处理)
  factorX ,#XCategory对应的 factor
  factorY ,#YCategory对应的 factor
  XAnalysisCategory , # 来自 data$XX,Category层次
  YAnalysisCategory , # 来自 data$YY,Category层次
  K, # 第一阶 meta 分析中的效应量数
  NK, # 总样本量
  rbar, # 原始平均相关
  Sr2.f, # 补充后的原始总方差
  tau2.r.f, # 原始异质性估计
  rhobar, # 原始校正后的相关系数
  tau2.rho.f, # 校正后异质性估计
  Src2.f, # 补充后的校正总方差
  CI95_LL, # 95%置信下限
  CI95_UL, # 95%置信上限
  CR80_LL, # 80%信用区间下限
  CR80_UL, # 80%信用区间上限
  rel.meta, # 可靠性指标
  AveSig2e, # 平均抽样方差(raw)
  AveSig2e.rho, # 平均抽样方差(校正)
  indM # 填补或修正方法记录矩阵/数据框
)


#write.xlsx(First.Meta, "VariablesOB1stOrdInput.xlsx", col.names = TRUE, row.names = FALSE)

6 2nd Order Meta-Analysis

6.1 OB/IB Variables

# 计算原始和校正相关的采样方差
vi <- Sr2.f / K
vic <- Src2.f / K

vi <- as.numeric(vi)

vic <- as.numeric(vic)



## Table 2 (Schmidt & Oh, 2008)
T2.col.names <- c(
  "XCategory", "YCategory", "Nmeta", "Nes", "Nes.used", "sumk", "sumN",
  "C6_Mean R", "C6_SE", "CI.LL", "CI.UL", "CV.LL", "CV.UL",
  "C7_Sampling Error Variance", "C8_Total Variance", "C9_True Variance", "C9_SE",
  "L1_Within-Meta Variance", "L2_Between-Meta Variance",
  "SE_L1_Within-Meta Variance", "SE_L2_Between-Meta Variance",
  "C10_Prop of Error Variance", "C11_Reliability"
)

# 每个X类别下有多少种Y类别
n.ycat.l <- lapply(YCategory.names, function(x) length(x))
# 总的 X-Y 组合数
n.xycat <- sum(unlist(n.ycat.l))
# X类别的唯一数量
n.xcat <- length(XCategory.names)

# 初始化Table2的矩阵
Table2SO.uc.y <- matrix(NA, n.xycat, 23)
colnames(Table2SO.uc.y) <- T2.col.names
rownames(Table2SO.uc.y) <- paste0("CatXY", 1:n.xycat)
Table2SO.c.y <- Table2SO.uc.y

# 初始化计数器
counti <- 0
branch_counter <- 0

for (j in 1:n.xcat) {
  crit1 <- (XCategory == XCategory.names[j])
  for (w in 1:n.ycat.l[[j]]) {
    counti <- counti + 1
    Table2SO.uc.y[counti, 1] <- XCategory.names[j]
    Table2SO.c.y[counti, 1] <- XCategory.names[j]
    Table2SO.uc.y[counti, 2] <- YCategory.names[[j]][w]
    Table2SO.c.y[counti, 2] <- YCategory.names[[j]][w]

    crit2 <- (YCategory == YCategory.names[[j]][w])
    sel <- which(crit1 * crit2 == 1)
    nes <- length(sel)
    nes.narm <- min(c(nes, length(na.omit(rbar[sel]))))
    sel.narm <- sel[is.na(rbar[sel]) == FALSE]
    sid <- meta.id[sel]
    nmeta <- length(unique(sid))
    if (nes.narm > 1) { # multiple effect sizes from multiple 1st-order meta analyses
      # If all effect sizes come from one 1st-order meta
      # MLM method does not work
      # We use RVE methods and assume the between-effect-size correlation = 0.8
      fit <- myrma.des(yi = rbar[sel], vi = vi[sel], sid, method = "MLM")
      fitc <- myrma.des(yi = rhobar[sel], vi = vic[sel], sid, method = "MLM")
      if (is.na(fit$b) | is.null(fit$b)) {
        fit <- list(rbar = NA_real_, sigma2 = NA_real_, vi = NA_real_, k = 0, nmeta = nmeta)
      }
      if (is.na(fitc$b) | is.null(fitc$b)) {
        fitc <- list(rbar = NA_real_, sigma2 = NA_real_, vi = NA_real_, k = 0, nmeta = nmeta)
      }
      if ((is.null(fit$rbar) - 1) + (is.null(fitc$rbar) - 1) < 0) {
        # 更新计数器,并打印当前组合信息及累计次数
        branch_counter <- branch_counter + 1
        cat(
          "执行rma分支的组合:", XCategory.names[j], "和", YCategory.names[[j]][w],
          ",累计执行次数:", branch_counter, "\n"
        )

        fit <- try(rma(yi = rbar[sel], vi = vi[sel]))
        fitc <- try(rma(yi = rhobar[sel], vi = vic[sel]))

        if (inherits(fit, "try-error")) {
          print("yyx fit error")
          fit <- list(b = NA, se = NA, sigma2 = NA, se.tau2 = NA, ci.lb = NA, ci.ub = NA)
        } else {
          fit$sigma2 <- fit$tau2
          cat("fit$k:", fit$k, "\n")
          if (fit$k == 1) {
            cat("打印fit结果:\n")
            print(fit$b)
            print(fit$se)
            print(fit$sigma2)
            print(fit)
          }
        }

        if (inherits(fitc, "try-error")) {
          print("yyx fit error")
          fitc <- list(b = NA, se = NA, sigma2 = NA, se.tau2 = NA, ci.lb = NA, ci.ub = NA)
        } else {
          fitc$sigma2 <- fitc$tau2
          cat("fitc$k:", fitc$k, "\n")
          if (fitc$k == 1) {
            cat("打印fitc结果:\n")
            print(fitc$b)
            print(fitc$se)
            print(fit$sigma2)
            print(fitc)
          }
        }
      }
    } else if (nes.narm == 1) { # only one effect size in this category
      print("只有一个效应量")
      fit <- list(
        rbar = rbar[sel.narm], sigma2 = tau2.r.f[sel.narm],
        vi = vi[sel.narm], k = 1, nmeta = nmeta
      )
      fitc <- list(
        rbar = rhobar[sel.narm], sigma2 = tau2.rho.f[sel.narm],
        vi = vic[sel.narm], k = 1, nmeta = nmeta
      )
    } else { # zero effect in this category
      fit <- list(rbar = NA, sigma2 = NA, vi = NA, k = 0, nmeta = nmeta)
      fitc <- list(rbar = NA, sigma2 = NA, vi = NA, k = 0, nmeta = nmeta)
    }
    Ksub <- K[sel]
    NKsub <- NK[sel]
    if (nes.narm != nes) {
      Ksub[is.na(rbar[sel]) == TRUE] <- NA
      NKsub[is.na(rbar[sel]) == TRUE] <- NA
    }
    Table2SO.uc.y[counti, 3:23] <- meta2nd.Table2SO(fit, Ksub, NKsub, nmeta)
    Table2SO.c.y[counti, 3:23] <- meta2nd.Table2SO(fitc, Ksub, NKsub, nmeta)
  }
}
## Error in eigen(x) : infinite or missing values in 'x'
## Error in eigen(x) : infinite or missing values in 'x'
## 执行rma分支的组合: abusive supervision 和 justice ,累计执行次数: 1 
## fit$k: 2 
## fitc$k: 2 
## Error in eigen(x) : infinite or missing values in 'x'
## 执行rma分支的组合: abusive supervision 和 satisfaction ,累计执行次数: 2 
## fit$k: 2 
## fitc$k: 2 
## Error in eigen(x) : infinite or missing values in 'x'
## Error in eigen(x) : infinite or missing values in 'x'
## 执行rma分支的组合: abusive supervision 和 withdraw ,累计执行次数: 3 
## fit$k: 2 
## fitc$k: 2
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## 执行rma分支的组合: agreeableness 和 commitment ,累计执行次数: 4
## Error in rma(yi = rbar[sel], vi = vi[sel]) : 
##   Processing terminated since k = 0.
## Error in rma(yi = rhobar[sel], vi = vic[sel]) : 
##   Processing terminated since k = 0.
## [1] "yyx fit error"
## [1] "yyx fit error"
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: change-oriented leader behavior 和 change-oriented leader behavior ,累计执行次数: 5
## fit$k: 2 
## fitc$k: 2
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## 执行rma分支的组合: change-oriented leader behavior 和 commitment ,累计执行次数: 6
## Error in rma(yi = rbar[sel], vi = vi[sel]) : 
##   Processing terminated since k = 0.
## Error in rma(yi = rhobar[sel], vi = vic[sel]) : 
##   Processing terminated since k = 0.
## [1] "yyx fit error"
## [1] "yyx fit error"
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: change-oriented leader behavior 和 contextual performance ,累计执行次数: 7
## fit$k: 10 
## fitc$k: 10
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## 执行rma分支的组合: change-oriented leader behavior 和 perception of support ,累计执行次数: 8
## Error in rma(yi = rbar[sel], vi = vi[sel]) : 
##   Processing terminated since k = 0.
## Error in rma(yi = rhobar[sel], vi = vic[sel]) : 
##   Processing terminated since k = 0.
## [1] "yyx fit error"
## [1] "yyx fit error"
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## 执行rma分支的组合: commitment 和 conscientiousness ,累计执行次数: 9
## Error in rma(yi = rbar[sel], vi = vi[sel]) : 
##   Processing terminated since k = 0.
## Error in rma(yi = rhobar[sel], vi = vic[sel]) : 
##   Processing terminated since k = 0.
## [1] "yyx fit error"
## [1] "yyx fit error"
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## 执行rma分支的组合: commitment 和 emotional stability ,累计执行次数: 10
## Error in rma(yi = rbar[sel], vi = vi[sel]) : 
##   Processing terminated since k = 0.
## Error in rma(yi = rhobar[sel], vi = vic[sel]) : 
##   Processing terminated since k = 0.
## [1] "yyx fit error"
## [1] "yyx fit error"
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## 执行rma分支的组合: commitment 和 extraversion ,累计执行次数: 11
## Error in rma(yi = rbar[sel], vi = vi[sel]) : 
##   Processing terminated since k = 0.
## Error in rma(yi = rhobar[sel], vi = vic[sel]) : 
##   Processing terminated since k = 0.
## [1] "yyx fit error"
## [1] "yyx fit error"
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: commitment 和 ksao ,累计执行次数: 12 
## fit$k: 6 
## fitc$k: 6
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## 执行rma分支的组合: commitment 和 openness to experience ,累计执行次数: 13
## Error in rma(yi = rbar[sel], vi = vi[sel]) : 
##   Processing terminated since k = 0.
## Error in rma(yi = rhobar[sel], vi = vic[sel]) : 
##   Processing terminated since k = 0.
## [1] "yyx fit error"
## [1] "yyx fit error"
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## Error in eigen(x) : infinite or missing values in 'x'
## 执行rma分支的组合: commitment 和 organizational outcome ,累计执行次数: 14
## fit$k: 2 
## fitc$k: 2
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: commitment 和 relational-oriented leader behavior ,累计执行次数: 15 
## fit$k: 4 
## fitc$k: 4 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: commitment 和 satisfaction ,累计执行次数: 16 
## fit$k: 6 
## fitc$k: 6 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: commitment 和 task performance ,累计执行次数: 17 
## fit$k: 6 
## fitc$k: 6 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: commitment 和 value-based and moral leader behavior ,累计执行次数: 18 
## fit$k: 6 
## fitc$k: 6 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: commitment 和 well-being ,累计执行次数: 19 
## fit$k: 2 
## fitc$k: 2 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: commitment 和 working experiences ,累计执行次数: 20 
## fit$k: 8 
## fitc$k: 8
## Error in eigen(x) : infinite or missing values in 'x'
## Error in eigen(x) : infinite or missing values in 'x'
## 执行rma分支的组合: contextual performance 和 organizational outcome ,累计执行次数: 21
## fit$k: 2 
## fitc$k: 2
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: contextual performance 和 stress ,累计执行次数: 22
## fit$k: 3 
## fitc$k: 3 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: contextual performance 和 task performance ,累计执行次数: 23 
## fit$k: 2 
## fitc$k: 2 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: contextual performance 和 team structure ,累计执行次数: 24
## fit$k: 4 
## fitc$k: 4
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## 执行rma分支的组合: contextual performance 和 well-being ,累计执行次数: 25
## Error in rma(yi = rbar[sel], vi = vi[sel]) : 
##   Processing terminated since k = 0.
## Error in rma(yi = rhobar[sel], vi = vic[sel]) : 
##   Processing terminated since k = 0.
## [1] "yyx fit error"
## [1] "yyx fit error"
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: demographics 和 demographics ,累计执行次数: 26 
## fit$k: 2 
## fitc$k: 2
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: demographics 和 motivation to work ,累计执行次数: 27 
## fit$k: 6 
## fitc$k: 6 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: demographics 和 perception of support ,累计执行次数: 28 
## fit$k: 4 
## fitc$k: 4 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: demographics 和 stress ,累计执行次数: 29 
## fit$k: 8 
## fitc$k: 8
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## 执行rma分支的组合: demographics 和 task performance ,累计执行次数: 30
## Error in rma(yi = rbar[sel], vi = vi[sel]) : 
##   Processing terminated since k = 0.
## Error in rma(yi = rhobar[sel], vi = vic[sel]) : 
##   Processing terminated since k = 0.
## [1] "yyx fit error"
## [1] "yyx fit error"
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## Error in t(data.full$e) %*% W : non-conformable arguments
## Error in t(data.full$e) %*% W : non-conformable arguments
## 执行rma分支的组合: emerging state 和 team composition ,累计执行次数: 31
## fit$k: 1 
## 打印fit结果:
##         [,1]
## intrcpt    0
## [1] 0.08349
## [1] 0
## 
## Random-Effects Model (k = 1; tau^2 estimator: REML)
## 
## tau^2 (estimated amount of total heterogeneity): 0
## tau (square root of estimated tau^2 value):      0
## I^2 (total heterogeneity / total variability):   0.00%
## H^2 (total variability / sampling variability):  1.00
## 
## Test for Heterogeneity:
## Q(df = 0) = 0.0000, p-val = 1.0000
## 
## Model Results:
## 
## estimate      se    zval    pval    ci.lb   ci.ub    
##   0.0000  0.0835  0.0000  1.0000  -0.1636  0.1636    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## fitc$k: 1 
## 打印fitc结果:
##         [,1]
## intrcpt    0
## [1] 0.1044
## [1] 0
## 
## Random-Effects Model (k = 1; tau^2 estimator: REML)
## 
## tau^2 (estimated amount of total heterogeneity): 0
## tau (square root of estimated tau^2 value):      0
## I^2 (total heterogeneity / total variability):   0.00%
## H^2 (total variability / sampling variability):  1.00
## 
## Test for Heterogeneity:
## Q(df = 0) = 0.0000, p-val = 1.0000
## 
## Model Results:
## 
## estimate      se    zval    pval    ci.lb   ci.ub    
##   0.0000  0.1044  0.0000  1.0000  -0.2045  0.2045    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: emerging state 和 team effectiveness ,累计执行次数: 32
## fit$k: 6 
## fitc$k: 6 
## Error in t(data.full$e) %*% W : non-conformable arguments
## Error in t(data.full$e) %*% W : non-conformable arguments
## 执行rma分支的组合: job involvement 和 stress ,累计执行次数: 33
## fit$k: 1 
## 打印fit结果:
##           [,1]
## intrcpt -0.104
## [1] 0.07679
## [1] 0
## 
## Random-Effects Model (k = 1; tau^2 estimator: REML)
## 
## tau^2 (estimated amount of total heterogeneity): 0
## tau (square root of estimated tau^2 value):      0
## I^2 (total heterogeneity / total variability):   0.00%
## H^2 (total variability / sampling variability):  1.00
## 
## Test for Heterogeneity:
## Q(df = 0) = 0.0000, p-val = 1.0000
## 
## Model Results:
## 
## estimate      se     zval    pval    ci.lb   ci.ub    
##  -0.1040  0.0768  -1.3544  0.1756  -0.2545  0.0465    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## fitc$k: 1 
## 打印fitc结果:
##          [,1]
## intrcpt -0.13
## [1] 0.09391
## [1] 0
## 
## Random-Effects Model (k = 1; tau^2 estimator: REML)
## 
## tau^2 (estimated amount of total heterogeneity): 0
## tau (square root of estimated tau^2 value):      0
## I^2 (total heterogeneity / total variability):   0.00%
## H^2 (total variability / sampling variability):  1.00
## 
## Test for Heterogeneity:
## Q(df = 0) = 0.0000, p-val = 1.0000
## 
## Model Results:
## 
## estimate      se     zval    pval    ci.lb   ci.ub    
##  -0.1300  0.0939  -1.3842  0.1663  -0.3141  0.0541    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## Error in eigen(x) : infinite or missing values in 'x'
## 执行rma分支的组合: job involvement 和 value-based and moral leader behavior ,累计执行次数: 34 
## fit$k: 2 
## fitc$k: 2
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: justice 和 motivation to work ,累计执行次数: 35
## fit$k: 2 
## fitc$k: 2 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: justice 和 relational-oriented leader behavior ,累计执行次数: 36 
## fit$k: 6 
## fitc$k: 6 
## Error in eigen(x) : infinite or missing values in 'x'
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: justice 和 satisfaction ,累计执行次数: 37
## fit$k: 2 
## fitc$k: 2 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: justice 和 well-being ,累计执行次数: 38 
## fit$k: 2 
## fitc$k: 2
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: ksao 和 organizational outcome ,累计执行次数: 39 
## fit$k: 8 
## fitc$k: 8 
## Error in eigen(x) : infinite or missing values in 'x'
## 执行rma分支的组合: ksao 和 perception of support ,累计执行次数: 40 
## fit$k: 2 
## fitc$k: 2 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: ksao 和 value-based and moral leader behavior ,累计执行次数: 41 
## fit$k: 2 
## fitc$k: 2 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: motivation to work 和 neuroticism ,累计执行次数: 42 
## fit$k: 4 
## fitc$k: 4 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: motivation to work 和 satisfaction ,累计执行次数: 43
## fit$k: 5 
## fitc$k: 5
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## 执行rma分支的组合: motivation to work 和 task performance ,累计执行次数: 44
## Error in rma(yi = rbar[sel], vi = vi[sel]) : 
##   Processing terminated since k = 0.
## Error in rma(yi = rhobar[sel], vi = vic[sel]) : 
##   Processing terminated since k = 0.
## [1] "yyx fit error"
## [1] "yyx fit error"
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## Error in t(data.full$e) %*% W : non-conformable arguments
## Error in t(data.full$e) %*% W : non-conformable arguments
## 执行rma分支的组合: motivation to work 和 team effectiveness ,累计执行次数: 45
## fit$k: 1 
## 打印fit结果:
##           [,1]
## intrcpt 0.3896
## [1] 0.03699
## [1] 0
## 
## Random-Effects Model (k = 1; tau^2 estimator: REML)
## 
## tau^2 (estimated amount of total heterogeneity): 0
## tau (square root of estimated tau^2 value):      0
## I^2 (total heterogeneity / total variability):   0.00%
## H^2 (total variability / sampling variability):  1.00
## 
## Test for Heterogeneity:
## Q(df = 0) = 0.0000, p-val = 1.0000
## 
## Model Results:
## 
## estimate      se     zval    pval   ci.lb   ci.ub      
##   0.3896  0.0370  10.5314  <.0001  0.3171  0.4621  *** 
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## fitc$k: 1 
## 打印fitc结果:
##          [,1]
## intrcpt 0.487
## [1] 0.04624
## [1] 0
## 
## Random-Effects Model (k = 1; tau^2 estimator: REML)
## 
## tau^2 (estimated amount of total heterogeneity): 0
## tau (square root of estimated tau^2 value):      0
## I^2 (total heterogeneity / total variability):   0.00%
## H^2 (total variability / sampling variability):  1.00
## 
## Test for Heterogeneity:
## Q(df = 0) = 0.0000, p-val = 1.0000
## 
## Model Results:
## 
## estimate      se     zval    pval   ci.lb   ci.ub      
##   0.4870  0.0462  10.5314  <.0001  0.3964  0.5776  *** 
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: motivation to work 和 well-being ,累计执行次数: 46
## fit$k: 2 
## fitc$k: 2
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## 执行rma分支的组合: organizational outcome 和 others ,累计执行次数: 47
## Error in rma(yi = rbar[sel], vi = vi[sel]) : 
##   Processing terminated since k = 0.
## Error in rma(yi = rhobar[sel], vi = vic[sel]) : 
##   Processing terminated since k = 0.
## [1] "yyx fit error"
## [1] "yyx fit error"
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: organizational outcome 和 perception of support ,累计执行次数: 48 
## fit$k: 2 
## fitc$k: 2 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: organizational outcome 和 satisfaction ,累计执行次数: 49 
## fit$k: 2 
## fitc$k: 2 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: organizational outcome 和 task performance ,累计执行次数: 50 
## fit$k: 2 
## fitc$k: 2
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## 执行rma分支的组合: others 和 others ,累计执行次数: 51
## Error in rma(yi = rbar[sel], vi = vi[sel]) : 
##   Processing terminated since k = 0.
## Error in rma(yi = rhobar[sel], vi = vic[sel]) : 
##   Processing terminated since k = 0.
## [1] "yyx fit error"
## [1] "yyx fit error"
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## Error in eigen(x) : infinite or missing values in 'x'
## Error in eigen(x) : infinite or missing values in 'x'
## 执行rma分支的组合: perception of support 和 perception of support ,累计执行次数: 52 
## fit$k: 2 
## fitc$k: 2 
## Error in eigen(x) : infinite or missing values in 'x'
## Error in eigen(x) : infinite or missing values in 'x'
## 执行rma分支的组合: perception of support 和 relational-oriented leader behavior ,累计执行次数: 53 
## fit$k: 2 
## fitc$k: 2
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: perception of support 和 task performance ,累计执行次数: 54 
## fit$k: 2 
## fitc$k: 2
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## 执行rma分支的组合: perception of support 和 value-based and moral leader behavior ,累计执行次数: 55
## Error in rma(yi = rbar[sel], vi = vi[sel]) : 
##   Processing terminated since k = 0.
## Error in rma(yi = rhobar[sel], vi = vic[sel]) : 
##   Processing terminated since k = 0.
## [1] "yyx fit error"
## [1] "yyx fit error"
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: perception of support 和 well-being ,累计执行次数: 56
## fit$k: 2 
## fitc$k: 2 
## Error in eigen(x) : infinite or missing values in 'x'
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: perception of support 和 working experiences ,累计执行次数: 57 
## fit$k: 2 
## fitc$k: 2 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: relational-oriented leader behavior 和 satisfaction ,累计执行次数: 58 
## fit$k: 2 
## fitc$k: 2 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: relational-oriented leader behavior 和 stress ,累计执行次数: 59
## fit$k: 6 
## fitc$k: 6 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: relational-oriented leader behavior 和 team effectiveness ,累计执行次数: 60 
## fit$k: 2 
## fitc$k: 2 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: relational-oriented leader behavior 和 well-being ,累计执行次数: 61
## fit$k: 6 
## fitc$k: 6 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: relational-oriented leader behavior 和 withdraw ,累计执行次数: 62 
## fit$k: 2 
## fitc$k: 2
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: satisfaction 和 withdraw ,累计执行次数: 63 
## fit$k: 2 
## fitc$k: 2
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: stress 和 withdraw ,累计执行次数: 64 
## fit$k: 4 
## fitc$k: 4 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: task performance 和 value-based and moral leader behavior ,累计执行次数: 65 
## fit$k: 4 
## fitc$k: 4 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: task-oriented behavior 和 team effectiveness ,累计执行次数: 66 
## fit$k: 2 
## fitc$k: 2 
## Error in eigen(x) : infinite or missing values in 'x'
## Error in eigen(x) : infinite or missing values in 'x'
## 执行rma分支的组合: team composition 和 team process ,累计执行次数: 67 
## fit$k: 2 
## fitc$k: 2 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: team effectiveness 和 team structure ,累计执行次数: 68 
## fit$k: 4 
## fitc$k: 4 
## Error in eigen(x) : infinite or missing values in 'x'
## 执行rma分支的组合: team effectiveness 和 withdraw ,累计执行次数: 69 
## fit$k: 6 
## fitc$k: 6 
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## 执行rma分支的组合: team process 和 team structure ,累计执行次数: 70 
## fit$k: 8 
## fitc$k: 8
## Error in solve.default(sumXWX.r) : 
##   Lapack routine dgesv: system is exactly singular: U[1,1] = 0
## Error in eigen(x) : infinite or missing values in 'x'
## 执行rma分支的组合: well-being 和 withdraw ,累计执行次数: 71 
## fit$k: 3 
## fitc$k: 3
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
##   'data' must be of a vector type, was 'NULL'
## 执行rma分支的组合: withdraw 和 withdraw ,累计执行次数: 72
## Error in rma(yi = rbar[sel], vi = vi[sel]) : 
##   Processing terminated since k = 0.
## Error in rma(yi = rhobar[sel], vi = vic[sel]) : 
##   Processing terminated since k = 0.
## [1] "yyx fit error"
## [1] "yyx fit error"
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
## [1] "nes.used <= 1, 1st order meta-analyses are not used."
 # write.xlsx(Table2SO.uc.y, "VariablesOB_Uncorrected.xlsx",
 #   col.names = T,
 #   row.names = T, sheetName = "Overall", append = T
 # )
 # write.xlsx(Table2SO.c.y, "VariablesOB_Corrected.xlsx",
 #  col.names = T,
 #   row.names = T, sheetName = "Overall", append = T
 # )

6.1.1 Table 2: Uncorrected Variables

# SOOutput(Table2SO.uc.y, NewVariables = NULL, Order = "-sumk", title = "Uncorrected Variables", TName = TRUE, note = TRUE, Cnote = FALSE, digits = FALSE)
SOOutput(Table2SO.uc.y, NewVariables = NULL, Order = "-sumk", title = "Uncorrected Variables", TName = TRUE, note = TRUE, Cnote = FALSE, digits =TRUE)
## SOOutput() is an R function for extracting and organizing second-order
## meta-analysis results.
## It extracts the following variables:
##   XCategory, YCategory,
## Nmeta, sumk, sumN,
##   C6_Mean.R, C6_SE, CI.LL, CI.UL, CV.LL, CV.UL,
##  
## C7_Sampling.Error.Variance, C8_Total.Variance, C9_True.Variance,
##  
## C10_Prop.of.Error.Variance, C11_Reliability.
## Additional parameters:
##   -
## NewVariables: Optional additional variables to include.
##   - Order: Specifies the
## sorting column (e.g., '-sumk' for descending order).
##   - title: Title for the
## output table.
##   - TName: If TRUE, renames the output columns to more intuitive
## names.
##   - digits: If TRUE, all numeric columns (except XCategory and YCategory)
## will be rounded to 3 decimal places and displayed in fixed notation; if FALSE,
## they remain unchanged.Uncorrected Variables
## ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
##                               X Category                            Y Category Number of Studies   Total k    Total N C6_Mean R    S.E. CI Lower CI Upper      CV Lower     CV Upper C7_Sampling Error Variance   C8_Total Variance    C9_True Variance C10_Prop of Error Variance Reliability
## ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## 1    commitment                          demographics                                      1.000 72205.000    183.000     0.054 (0.000)    0.054    0.054         0.054        0.054                      0.000               0.000               0.000                      1.000       0.000
## 2    commitment                          commitment                                        2.000 69656.000  18453.000     0.211 (0.081)    0.052    0.370        -0.170        0.593                      0.000               0.089               0.089                      0.000       1.000
## 3    commitment                          satisfaction                                      1.000 49092.000    138.000     0.233 (0.098)    0.041    0.426        -0.075        0.542                      0.000               0.058               0.058                      0.000       1.000
## 4    commitment                          working experiences                               1.000 46678.000    126.000     0.120 (0.020)    0.080    0.160         0.046        0.194                      0.000               0.003               0.003                      0.000       1.000
## 5    commitment                          withdraw                                          2.000 40554.000  11752.000    -0.385 (0.104)   -0.588   -0.182        -0.617       -0.154                      0.000               0.033               0.033                      0.000       1.000
## 6    commitment                          ksao                                              1.000 20140.000     64.000    -0.035 (0.017)   -0.068   -0.001        -0.088        0.019                      0.000               0.002               0.002                      0.001       0.999
## 7    commitment                          perception of support                             3.000 16989.000 191431.000     0.317 (0.087)    0.146    0.488         0.008        0.627                      0.000               0.058               0.058                      0.000       1.000
## 8    commitment                          stress                                            2.000 15748.000  69695.821    -0.157 (0.051)   -0.257   -0.058        -0.356        0.041                      0.000               0.024               0.024                      0.000       1.000
## 9    commitment                          contextual performance                            3.000 14625.000  39850.000     0.250 (0.065)    0.124    0.377         0.034        0.467                      0.000               0.029               0.029                      0.000       1.000
## 10   commitment                          task performance                                  1.000 12074.000     46.000     0.037 (0.033)   -0.027    0.102        -0.066        0.141                      0.000               0.007               0.007                      0.000       1.000
## 11   contextual performance              demographics                                      1.000   679.000  88125.000     0.063 (0.000)    0.063    0.063 -25676069.514 25676069.640                      0.000 401406976898432.000 401406976898432.000                      0.000       1.000
## 12   perceived fit                       satisfaction                                      3.000   628.000 573257.000     0.062 (0.380)   -0.683    0.807        -0.629        0.753                      0.000               0.291               0.291                      0.001       0.999
## 13   demographics                        task performance                                  1.000   498.000  62540.000                                                                                                                                                                         
## 14   perceived fit                       withdraw                                          2.000   493.000 525674.000     0.008 (0.310)   -0.599    0.616        -0.556        0.572                      0.000               0.194               0.194                      0.002       0.998
## 15   commitment                          perceived fit                                     2.000   480.000 141484.000     0.128 (0.357)   -0.572    0.827        -0.521        0.776                      0.001               0.258               0.256                      0.006       0.994
## 16   organizational outcome              withdraw                                          2.000   405.000 290637.100    -0.058 (0.025)   -0.106   -0.009        -0.109       -0.006                      0.000               0.002               0.002                      0.076       0.924
## 17   motivation to work                  stress                                            2.000   332.000 262994.000    -0.067 (0.040)   -0.146    0.012        -0.269        0.136                      0.001               0.026               0.025                      0.032       0.968
## 18   demographics                        stress                                            1.000   326.000 126933.000    -0.082 (0.061)   -0.202    0.038        -0.301        0.137                      0.000               0.029               0.029                      0.007       0.993
## 19   perception of support               satisfaction                                      3.000   306.000 163410.000     0.404 (0.077)    0.253    0.555         0.226        0.582                      0.001               0.020               0.019                      0.052       0.948
## 20   perception of support               withdraw                                          3.000   257.000  91904.000    -0.282 (0.073)   -0.425   -0.138        -0.455       -0.108                      0.001               0.020               0.018                      0.075       0.925
## 21   contextual performance              perception of support                             2.000   239.000  77545.518     0.287 (0.080)    0.131    0.444         0.146        0.429                      0.000               0.013               0.012                      0.022       0.978
## 22   perceived fit                       perceived fit                                     1.000   204.000 175261.000     0.490 (0.000)    0.490    0.490  -4053532.174  4053533.154                      0.001  10004495264093.100  10004495264093.100                      0.000       1.000
## 23   change-oriented leader behavior     contextual performance                            1.000   183.000  49631.000     0.254 (0.025)    0.204    0.304         0.163        0.344                      0.001               0.006               0.005                      0.156       0.844
## 24   perceived fit                       task performance                                  2.000   179.000 355613.000     0.079 (0.116)   -0.147    0.306        -0.130        0.289                      0.000               0.027               0.027                      0.005       0.995
## 25   relational-oriented leader behavior task performance                                  2.000   162.000  31664.000     0.269 (0.022)    0.226    0.311         0.220        0.317                      0.001               0.002               0.001                      0.309       0.691
## 26   perception of support               stress                                            2.000   160.000 134049.473    -0.179 (0.032)   -0.241   -0.117        -0.260       -0.097                      0.002               0.006               0.004                      0.337       0.663
## 27   perception of support               task performance                                  1.000   158.000  46769.000     0.222 (0.055)    0.114    0.330         0.127        0.317                      0.000               0.006               0.006                      0.051       0.949
## 28   stress                              stress                                            4.000   153.000  91863.816     0.425 (0.046)    0.334    0.515         0.327        0.522                      0.001               0.007               0.006                      0.178       0.822
## 29   contextual performance              contextual performance                            5.000   151.000  32961.221     0.348 (0.033)    0.283    0.412         0.256        0.439                      0.005               0.010               0.005                      0.472       0.528
## 30   withdraw                            withdraw                                          1.000   150.000 215840.000                                                                                                                                                                         
## 31   contextual performance              team structure                                    1.000   123.000  10143.000    -0.074 (0.171)   -0.409    0.262        -0.510        0.363                      0.001               0.117               0.116                      0.009       0.991
## 32   change-oriented leader behavior     team effectiveness                                1.000   112.000  11676.000     0.269 (0.000)    0.269    0.269  -5451411.119  5451411.657                      0.002  18094464847649.398  18094464847649.398                      0.000       1.000
## 33   abusive supervision                 contextual performance                            2.000   111.000  32588.480    -0.277 (0.074)   -0.421   -0.132        -0.440       -0.113                      0.002               0.018               0.016                      0.099       0.901
## 34   emerging state                      team effectiveness                                1.000   110.000  20355.153     0.091 (0.022)    0.047    0.135         0.035        0.146                      0.000               0.002               0.002                      0.179       0.821
## 35   commitment                          relational-oriented leader behavior               1.000   105.000  26031.000     0.389 (0.043)    0.305    0.473         0.295        0.483                      0.001               0.006               0.005                      0.093       0.907
## 36   motivation to work                  team effectiveness                                1.000   104.000   9400.000     0.390 (0.037)    0.317    0.462         0.390        0.390                      0.142               0.142               0.000                      1.000       0.000
## 37   team process                        team structure                                    1.000   101.000   6754.000     0.366 (0.058)    0.253    0.480         0.165        0.567                      0.002               0.027               0.025                      0.073       0.927
## 38   motivation to work                  perception of support                             2.000    98.000  86607.000     0.239 (0.062)    0.117    0.362         0.122        0.357                      0.002               0.010               0.008                      0.156       0.844
## 39   satisfaction                        stress                                            2.000    98.000  77616.298    -0.182 (0.034)   -0.248   -0.116        -0.270       -0.095                      0.003               0.007               0.005                      0.371       0.629
## 40   relational-oriented leader behavior satisfaction                                      1.000    97.000  22081.000     0.446 (0.019)    0.408    0.483         0.425        0.466                      0.000               0.001               0.000                      0.655       0.345
## 41   team effectiveness                  team structure                                    1.000    92.000   6804.000     0.192 (0.051)    0.093    0.291         0.076        0.309                      0.001               0.010               0.008                      0.141       0.859
## 42   contextual performance              motivation to work                                2.000    91.000  24433.656     0.217 (0.081)    0.058    0.377         0.051        0.383                      0.005               0.022               0.017                      0.221       0.779
## 43   motivation to work                  satisfaction                                      1.000    89.000  72937.000     0.372 (0.025)    0.323    0.422         0.315        0.430                      0.001               0.003               0.002                      0.297       0.703
## 44   contextual performance              relational-oriented leader behavior               2.000    88.000  17875.000     0.305 (0.037)    0.232    0.378         0.247        0.364                      0.001               0.003               0.002                      0.217       0.783
## 45   relational-oriented leader behavior stress                                            1.000    88.000  42472.000    -0.167 (0.027)   -0.219   -0.114        -0.242       -0.092                      0.001               0.004               0.003                      0.128       0.872
## 46   justice                             relational-oriented leader behavior               1.000    87.000  20265.000     0.484 (0.052)    0.383    0.585         0.335        0.633                      0.002               0.015               0.014                      0.115       0.885
## 47   commitment                          conscientiousness                                 1.000    84.000  24347.000                                                                                                                                                                         
## 48   commitment                          extraversion                                      1.000    82.000  23473.000                                                                                                                                                                         
## 49   task performance                    well-being                                        2.000    78.000  18861.946     0.246 (0.022)    0.203    0.289         0.177        0.315                      0.001               0.004               0.003                      0.262       0.738
## 50   commitment                          justice                                           2.000    76.000  21451.839     0.316 (0.036)    0.245    0.387         0.234        0.397                      0.001               0.005               0.004                      0.213       0.787
## 51   commitment                          emotional stability                               1.000    75.000  25315.000                                                                                                                                                                         
## 52   justice                             stress                                            1.000    69.000  18272.885    -0.313 (0.000)   -0.313   -0.313  -4796903.119  4796902.492                      0.001  14010372004626.400  14010372004626.400                      0.000       1.000
## 53   motivation to work                  task performance                                  1.000    67.000  18296.000                                                                                                                                                                         
## 54   agreeableness                       commitment                                        1.000    66.000  19752.000                                                                                                                                                                         
## 55   ksao                                organizational outcome                            1.000    66.000  15696.000     0.566 (0.034)    0.501    0.632         0.470        0.663                      0.002               0.008               0.006                      0.296       0.704
## 56   commitment                          openness to experience                            1.000    63.000  16297.000                                                                                                                                                                         
## 57   others                              others                                            1.000    63.000  14120.000                                                                                                                                                                         
## 58   team effectiveness                  withdraw                                          1.000    62.000  20796.170    -0.386 (0.030)   -0.444   -0.328        -0.386       -0.386                      0.005               0.005               0.000                      1.000       0.000
## 59   demographics                        ksao                                              1.000    61.000  18590.000     0.201 (0.000)    0.201    0.201  -4905462.203  4905462.604                      0.004  14651690364025.100  14651690364025.100                      0.000       1.000
## 60   relational-oriented leader behavior withdraw                                          1.000    58.000  16611.000    -0.272 (0.065)   -0.399   -0.146        -0.381       -0.163                      0.000               0.008               0.007                      0.058       0.942
## 61   job involvement                     perception of support                             1.000    51.000  17571.000     0.365 (0.000)      NaN      NaN         0.365        0.365                      0.001               0.001               0.000                      1.000       0.000
## 62   abusive supervision                 stress                                            2.000    48.000  14178.664     0.330 (0.049)    0.234    0.426         0.243        0.417                      0.001               0.006               0.005                      0.211       0.789
## 63   relational-oriented leader behavior team effectiveness                                1.000    48.000   4510.000     0.360 (0.041)    0.278    0.441         0.291        0.428                      0.001               0.003               0.003                      0.161       0.839
## 64   justice                             withdraw                                          2.000    47.000  12030.381    -0.133 (0.061)   -0.253   -0.013        -0.237       -0.029                      0.001               0.008               0.007                      0.136       0.864
## 65   satisfaction                        well-being                                        2.000    46.000  12021.801     0.323 (0.048)    0.230    0.416         0.161        0.484                      0.001               0.017               0.016                      0.050       0.950
## 66   ksao                                task performance                                  1.000    45.000   9829.000     0.392 (0.000)    0.392    0.392  -8715431.988  8715432.773                      0.009  46249357568519.102  46249357568519.102                      0.000       1.000
## 67   contextual performance              stress                                            1.000    43.000  11818.000    -0.364 (0.060)   -0.480   -0.247        -0.487       -0.241                      0.001               0.010               0.009                      0.110       0.890
## 68   contextual performance              organizational outcome                            1.000    42.000  11122.625     0.332 (0.040)    0.254    0.410         0.332        0.332                      0.003               0.003               0.000                      1.000       0.000
## 69   contextual performance              value-based and moral leader behavior             1.000    42.000  15885.000     0.412 (0.000)    0.412    0.412  -3236835.036  3236835.860                      0.004   6379241920485.400   6379241920485.400                      0.000       1.000
## 70   contextual performance              well-being                                        1.000    42.000  11122.625                                                                                                                                                                         
## 71   demographics                        perception of support                             1.000    42.000  13530.000    -0.043 (0.025)   -0.092    0.005        -0.096        0.010                      0.001               0.002               0.002                      0.265       0.735
## 72   justice                             satisfaction                                      1.000    42.000  12001.839     0.382 (0.025)    0.332    0.431         0.382        0.382                      0.001               0.001               0.000                      1.000       0.000
## 73   contextual performance              task performance                                  1.000    40.000   3290.000     0.383 (0.039)    0.306    0.460         0.325        0.441                      0.001               0.003               0.002                      0.294       0.706
## 74   demographics                        motivation to work                                1.000    38.000  96269.000     0.035 (0.037)   -0.037    0.108        -0.073        0.144                      0.000               0.007               0.007                      0.035       0.965
## 75   satisfaction                        withdraw                                          1.000    38.000  12783.000    -0.445 (0.092)   -0.625   -0.265        -0.606       -0.284                      0.001               0.017               0.016                      0.066       0.934
## 76   motivation to work                  others                                            1.000    36.000   6987.000     0.127 (0.000)    0.127    0.127 -11033825.412 11033825.665                      0.003  74127619679825.094  74127619679825.094                      0.000       1.000
## 77   organizational outcome              motivation to work                                2.000    36.000   6671.000     0.255 (0.033)    0.191    0.320         0.255        0.255                      0.002               0.002               0.000                      1.000       0.000
## 78   organizational outcome              others                                            1.000    36.000   9533.679                                                                                                                                                                         
## 79   relational-oriented leader behavior well-being                                        1.000    36.000  15086.000     0.338 (0.027)    0.285    0.391         0.269        0.407                      0.001               0.004               0.003                      0.318       0.682
## 80   change-oriented leader behavior     change-oriented leader behavior                   1.000    33.000   8739.206     0.227 (0.182)   -0.131    0.584        -0.064        0.518                      0.001               0.052               0.052                      0.018       0.982
## 81   contextual performance              emerging state                                    2.000    33.000   4378.000     0.366 (0.120)    0.130    0.602         0.154        0.578                      0.002               0.029               0.027                      0.061       0.939
## 82   motivation to work                  neuroticism                                       1.000    31.000   5310.000     0.030 (0.269)   -0.496    0.556        -0.648        0.708                      0.004               0.284               0.280                      0.016       0.984
## 83   justice                             motivation to work                                1.000    28.000   7804.839     0.406 (0.035)    0.338    0.474         0.389        0.423                      0.002               0.002               0.000                      0.926       0.074
## 84   stress                              well-being                                        2.000    27.000  11720.244    -0.083 (0.035)   -0.152   -0.013        -0.133       -0.032                      0.003               0.005               0.002                      0.675       0.325
## 85   contextual performance              others                                            2.000    26.000   7319.839     0.312 (0.044)    0.227    0.397         0.312        0.312                      0.004               0.004               0.000                      1.000       0.000
## 86   task-oriented behavior              team effectiveness                                1.000    26.000   2982.000     0.314 (0.061)    0.194    0.435         0.209        0.419                      0.001               0.008               0.007                      0.109       0.891
## 87   commitment                          value-based and moral leader behavior             1.000    23.000   8825.000     0.544 (0.016)    0.512    0.575         0.541        0.546                      0.002               0.002               0.000                      0.998       0.002
## 88   job involvement                     well-being                                        2.000    22.000   6966.717     0.266 (0.016)    0.235    0.296         0.266        0.266                      0.001               0.001               0.000                      1.000       0.000
## 89   justice                             well-being                                        1.000    22.000   5826.137    -0.250 (0.100)   -0.446   -0.054        -0.427       -0.073                      0.001               0.020               0.019                      0.047       0.953
## 90   abusive supervision                 satisfaction                                      1.000    20.000   5296.488    -0.297 (0.021)   -0.339   -0.255        -0.297       -0.297                      0.001               0.001               0.000                      1.000       0.000
## 91   stress                              withdraw                                          1.000    20.000   6673.000     0.414 (0.038)    0.340    0.488         0.342        0.486                      0.002               0.005               0.003                      0.326       0.674
## 92   change-oriented leader behavior     commitment                                        1.000    19.000   7472.000                                                                                                                                                                         
## 93   well-being                          well-being                                        2.000    19.000   6246.366     0.229 (0.035)    0.161    0.298         0.172        0.287                      0.001               0.003               0.002                      0.373       0.627
## 94   perception of support               well-being                                        1.000    16.000   6421.473     0.264 (0.064)    0.138    0.389         0.160        0.368                      0.002               0.008               0.007                      0.200       0.800
## 95   task performance                    value-based and moral leader behavior             1.000    16.000   4322.000     0.313 (0.070)    0.176    0.449         0.182        0.443                      0.008               0.019               0.010                      0.450       0.550
## 96   abusive supervision                 task performance                                  1.000    15.000   3972.366    -0.108 (0.000)      NaN      NaN        -0.108       -0.108                      0.002               0.002               0.000                      1.000       0.000
## 97   abusive supervision                 withdraw                                          1.000    15.000   3972.366     0.192 (0.060)    0.074    0.309         0.192        0.192                      0.007               0.007               0.000                      1.000       0.000
## 98   perception of support               working experiences                               1.000    14.000   4139.000    -0.008 (0.028)   -0.062    0.046        -0.008       -0.008                      0.002               0.002               0.000                      1.000       0.000
## 99   motivation to work                  well-being                                        1.000    12.000   4489.649     0.206 (0.063)    0.082    0.330         0.107        0.305                      0.001               0.007               0.006                      0.197       0.803
## 100  commitment                          organizational outcome                            1.000    11.000   2534.000     0.510 (0.053)    0.406    0.614         0.486        0.534                      0.005               0.006               0.000                      0.937       0.063
## 101  demographics                        demographics                                      1.000    11.000  11680.000    -0.010 (0.100)   -0.205    0.185        -0.183        0.163                      0.002               0.020               0.018                      0.079       0.921
## 102  emerging state                      team composition                                  1.000    11.000    768.000     0.000 (0.083)   -0.164    0.164         0.000        0.000                      0.077               0.077               0.000                      1.000       0.000
## 103  perception of support               relational-oriented leader behavior               1.000    11.000   2621.000     0.265 (0.042)    0.184    0.347         0.265        0.265                      0.003               0.003               0.000                      1.000       0.000
## 104  abusive supervision                 justice                                           1.000    10.000   2648.244    -0.282 (0.049)   -0.378   -0.186        -0.282       -0.282                      0.005               0.005               0.000                      1.000       0.000
## 105  organizational outcome              satisfaction                                      1.000    10.000   4392.000     0.191 (0.090)    0.015    0.367         0.033        0.349                      0.001               0.016               0.015                      0.060       0.940
## 106  well-being                          withdraw                                          1.000    10.000   2648.244    -0.164 (0.035)   -0.234   -0.095        -0.224       -0.104                      0.001               0.004               0.002                      0.377       0.623
## 107  team composition                    team process                                      1.000     9.000    530.000    -0.033 (0.082)   -0.195    0.128        -0.033       -0.033                      0.014               0.014               0.000                      1.000       0.000
## 108  job involvement                     stress                                            1.000     7.000   2666.649    -0.104 (0.077)   -0.255    0.047        -0.104       -0.104                      0.041               0.041               0.000                      1.000       0.000
## 109  organizational outcome              perception of support                             1.000     7.000   1701.000     0.382 (0.064)    0.257    0.507         0.305        0.459                      0.004               0.008               0.004                      0.543       0.457
## 110  perception of support               perception of support                             1.000     7.000   1303.000     0.171 (0.034)    0.105    0.237         0.171        0.171                      0.002               0.002               0.000                      1.000       0.000
## 111  commitment                          well-being                                        1.000     6.000   1588.946     0.248 (0.056)    0.139    0.358         0.156        0.341                      0.001               0.006               0.005                      0.178       0.822
## 112  job involvement                     value-based and moral leader behavior             1.000     6.000   3566.000     0.486 (0.036)    0.415    0.557         0.486        0.486                      0.003               0.003               0.000                      1.000       0.000
## 113  ksao                                perception of support                             1.000     5.000   2249.000    -0.016 (0.023)   -0.060    0.028        -0.016       -0.016                      0.001               0.001               0.000                      1.000       0.000
## 114  ksao                                value-based and moral leader behavior             1.000     5.000   1306.000     0.391 (0.090)    0.215    0.568         0.236        0.547                      0.001               0.016               0.015                      0.089       0.911
## 115  organizational outcome              task performance                                  1.000     5.000   1013.000     0.343 (0.070)    0.206    0.480         0.250        0.437                      0.004               0.010               0.005                      0.458       0.542
## 116  perception of support               value-based and moral leader behavior             1.000     5.000   1179.000                                                                                                                                                                         
## 117  change-oriented leader behavior     perception of support                             1.000     3.000   1148.000                                                                                                                                                                         
## ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

6.1.2 Table 2: Corrected Variables

SOOutput(Table2SO.c.y, NewVariables = NULL, Order = "-sumk", title = "Uncorrected Variables", TName = TRUE, note = TRUE, Cnote = FALSE, digits = TRUE)
## SOOutput() is an R function for extracting and organizing second-order
## meta-analysis results.
## It extracts the following variables:
##   XCategory, YCategory,
## Nmeta, sumk, sumN,
##   C6_Mean.R, C6_SE, CI.LL, CI.UL, CV.LL, CV.UL,
##  
## C7_Sampling.Error.Variance, C8_Total.Variance, C9_True.Variance,
##  
## C10_Prop.of.Error.Variance, C11_Reliability.
## Additional parameters:
##   -
## NewVariables: Optional additional variables to include.
##   - Order: Specifies the
## sorting column (e.g., '-sumk' for descending order).
##   - title: Title for the
## output table.
##   - TName: If TRUE, renames the output columns to more intuitive
## names.
##   - digits: If TRUE, all numeric columns (except XCategory and YCategory)
## will be rounded to 3 decimal places and displayed in fixed notation; if FALSE,
## they remain unchanged.Uncorrected Variables
## ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
##                               X Category                            Y Category Number of Studies   Total k    Total N C6_Mean R    S.E. CI Lower CI Upper      CV Lower     CV Upper C7_Sampling Error Variance   C8_Total Variance    C9_True Variance C10_Prop of Error Variance Reliability
## ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## 1    commitment                          demographics                                      1.000 72205.000    183.000     0.068 (0.000)    0.067    0.068         0.068        0.068                      0.000               0.000               0.000                      1.000       0.000
## 2    commitment                          commitment                                        2.000 69656.000  18453.000     0.262 (0.102)    0.062    0.462        -0.210        0.735                      0.000               0.136               0.136                      0.000       1.000
## 3    commitment                          satisfaction                                      1.000 49092.000    138.000     0.292 (0.123)    0.051    0.532        -0.094        0.677                      0.000               0.090               0.090                      0.000       1.000
## 4    commitment                          working experiences                               1.000 46678.000    126.000     0.150 (0.025)    0.100    0.200         0.058        0.242                      0.000               0.005               0.005                      0.000       1.000
## 5    commitment                          withdraw                                          2.000 40554.000  11752.000    -0.481 (0.130)   -0.735   -0.227        -0.771       -0.192                      0.000               0.051               0.051                      0.000       1.000
## 6    commitment                          ksao                                              1.000 20140.000     64.000    -0.043 (0.021)   -0.085   -0.001        -0.110        0.024                      0.000               0.003               0.003                      0.001       0.999
## 7    commitment                          perception of support                             3.000 16989.000 191431.000     0.397 (0.117)    0.169    0.626         0.004        0.791                      0.000               0.094               0.094                      0.000       1.000
## 8    commitment                          stress                                            2.000 15748.000  69695.821    -0.197 (0.063)   -0.321   -0.072        -0.444        0.051                      0.000               0.037               0.037                      0.000       1.000
## 9    commitment                          contextual performance                            3.000 14625.000  39850.000     0.313 (0.080)    0.156    0.470         0.041        0.585                      0.000               0.045               0.045                      0.000       1.000
## 10   commitment                          task performance                                  1.000 12074.000     46.000     0.047 (0.041)   -0.034    0.128        -0.083        0.176                      0.000               0.010               0.010                      0.000       1.000
## 11   contextual performance              demographics                                      1.000   679.000  88125.000     0.079 (0.000)    0.079    0.079         0.079        0.079                      0.001               0.001               0.000                      1.000       0.000
## 12   perceived fit                       satisfaction                                      3.000   628.000 573257.000     0.078 (0.440)   -0.784    0.940        -0.722        0.878                      0.000               0.390               0.390                      0.001       0.999
## 13   demographics                        task performance                                  1.000   498.000  62540.000                                                                                                                                                                         
## 14   perceived fit                       withdraw                                          2.000   493.000 525674.000     0.004 (0.354)   -0.690    0.699        -0.640        0.649                      0.001               0.254               0.253                      0.002       0.998
## 15   commitment                          perceived fit                                     2.000   480.000 141484.000     0.150 (0.409)   -0.653    0.952        -0.596        0.895                      0.002               0.340               0.338                      0.005       0.995
## 16   organizational outcome              withdraw                                          2.000   405.000 290637.100    -0.072 (0.031)   -0.134   -0.011        -0.137       -0.008                      0.000               0.003               0.003                      0.075       0.925
## 17   motivation to work                  stress                                            2.000   332.000 262994.000    -0.084 (0.050)   -0.182    0.014        -0.335        0.167                      0.001               0.040               0.038                      0.036       0.964
## 18   demographics                        stress                                            1.000   326.000 126933.000    -0.089 (0.072)   -0.230    0.053        -0.343        0.165                      0.001               0.040               0.039                      0.023       0.977
## 19   perception of support               satisfaction                                      3.000   306.000 163410.000     0.490 (0.098)    0.298    0.681         0.262        0.717                      0.001               0.033               0.032                      0.033       0.967
## 20   perception of support               withdraw                                          3.000   257.000  91904.000    -0.350 (0.093)   -0.533   -0.167        -0.571       -0.130                      0.002               0.031               0.030                      0.051       0.949
## 21   contextual performance              perception of support                             2.000   239.000  77545.518     0.369 (0.160)    0.055    0.682         0.080        0.657                      0.000               0.051               0.051                      0.005       0.995
## 22   perceived fit                       perceived fit                                     1.000   204.000 175261.000     0.575 (0.000)    0.575    0.575  -7013353.496  7013354.645                      0.001  29948795390756.500  29948795390756.500                      0.000       1.000
## 23   change-oriented leader behavior     contextual performance                            1.000   183.000  49631.000     0.273 (0.026)    0.221    0.325         0.180        0.366                      0.001               0.006               0.005                      0.152       0.848
## 24   perceived fit                       task performance                                  2.000   179.000 355613.000     0.095 (0.134)   -0.167    0.358        -0.148        0.339                      0.000               0.036               0.036                      0.003       0.997
## 25   relational-oriented leader behavior task performance                                  2.000   162.000  31664.000     0.324 (0.034)    0.256    0.391         0.235        0.413                      0.001               0.005               0.005                      0.101       0.899
## 26   perception of support               stress                                            2.000   160.000 134049.473    -0.201 (0.042)   -0.283   -0.118        -0.297       -0.104                      0.003               0.008               0.006                      0.306       0.694
## 27   perception of support               task performance                                  1.000   158.000  46769.000     0.253 (0.085)    0.087    0.420         0.102        0.405                      0.000               0.014               0.014                      0.018       0.982
## 28   stress                              stress                                            4.000   153.000  91863.816     0.518 (0.045)    0.430    0.607         0.425        0.611                      0.002               0.007               0.005                      0.284       0.716
## 29   contextual performance              contextual performance                            5.000   151.000  32961.221     0.408 (0.034)    0.341    0.476         0.327        0.490                      0.007               0.011               0.004                      0.619       0.381
## 30   withdraw                            withdraw                                          1.000   150.000 215840.000                                                                                                                                                                         
## 31   contextual performance              team structure                                    1.000   123.000  10143.000    -0.092 (0.214)   -0.511    0.327        -0.638        0.453                      0.002               0.183               0.181                      0.009       0.991
## 32   change-oriented leader behavior     team effectiveness                                1.000   112.000  11676.000     0.302              NaN      NaN  -6127108.643  6127109.248                      0.002  22858042405701.699  22858042405701.699                      0.000       1.000
## 33   abusive supervision                 contextual performance                            2.000   111.000  32588.480    -0.339 (0.089)   -0.514   -0.165        -0.536       -0.143                      0.002               0.026               0.023                      0.088       0.912
## 34   emerging state                      team effectiveness                                1.000   110.000  20355.153     0.114 (0.028)    0.059    0.168         0.044        0.183                      0.001               0.004               0.003                      0.179       0.821
## 35   commitment                          relational-oriented leader behavior               1.000   105.000  26031.000     0.438 (0.056)    0.328    0.549         0.307        0.570                      0.000               0.011               0.010                      0.039       0.961
## 36   motivation to work                  team effectiveness                                1.000   104.000   9400.000     0.487 (0.046)    0.396    0.578         0.487        0.487                      0.222               0.222               0.000                      1.000       0.000
## 37   team process                        team structure                                    1.000   101.000   6754.000     0.476 (0.076)    0.327    0.624         0.209        0.742                      0.002               0.046               0.043                      0.049       0.951
## 38   motivation to work                  perception of support                             2.000    98.000  86607.000     0.303 (0.084)    0.139    0.468         0.141        0.465                      0.002               0.018               0.016                      0.130       0.870
## 39   satisfaction                        stress                                            2.000    98.000  77616.298    -0.231 (0.043)   -0.315   -0.147        -0.344       -0.118                      0.004               0.012               0.008                      0.359       0.641
## 40   relational-oriented leader behavior satisfaction                                      1.000    97.000  22081.000     0.502 (0.050)    0.404    0.600         0.415        0.588                      0.000               0.005               0.005                      0.080       0.920
## 41   team effectiveness                  team structure                                    1.000    92.000   6804.000     0.227 (0.061)    0.108    0.346         0.084        0.370                      0.001               0.014               0.012                      0.092       0.908
## 42   contextual performance              motivation to work                                2.000    91.000  24433.656     0.272 (0.102)    0.072    0.471         0.064        0.479                      0.007               0.034               0.026                      0.221       0.779
## 43   motivation to work                  satisfaction                                      1.000    89.000  72937.000     0.476 (0.031)    0.415    0.537         0.408        0.543                      0.001               0.004               0.003                      0.348       0.652
## 44   contextual performance              relational-oriented leader behavior               2.000    88.000  17875.000     0.367 (0.064)    0.241    0.493         0.257        0.477                      0.000               0.008               0.007                      0.060       0.940
## 45   relational-oriented leader behavior stress                                            1.000    88.000  42472.000    -0.192 (0.030)   -0.251   -0.134        -0.277       -0.108                      0.001               0.005               0.004                      0.122       0.878
## 46   justice                             relational-oriented leader behavior               1.000    87.000  20265.000     0.566 (0.062)    0.444    0.687         0.381        0.750                      0.002               0.022               0.021                      0.069       0.931
## 47   commitment                          conscientiousness                                 1.000    84.000  24347.000                                                                                                                                                                         
## 48   commitment                          extraversion                                      1.000    82.000  23473.000                                                                                                                                                                         
## 49   task performance                    well-being                                        2.000    78.000  18861.946     0.321 (0.024)    0.274    0.368         0.249        0.393                      0.001               0.004               0.003                      0.290       0.710
## 50   commitment                          justice                                           2.000    76.000  21451.839     0.399 (0.024)    0.351    0.447         0.360        0.438                      0.001               0.002               0.001                      0.588       0.412
## 51   commitment                          emotional stability                               1.000    75.000  25315.000                                                                                                                                                                         
## 52   justice                             stress                                            1.000    69.000  18272.885    -0.363 (0.000)   -0.363   -0.363        -0.363       -0.363                      0.001               0.001               0.000                      1.000       0.000
## 53   motivation to work                  task performance                                  1.000    67.000  18296.000                                                                                                                                                                         
## 54   agreeableness                       commitment                                        1.000    66.000  19752.000                                                                                                                                                                         
## 55   ksao                                organizational outcome                            1.000    66.000  15696.000     0.662 (0.036)    0.591    0.732         0.558        0.765                      0.003               0.009               0.007                      0.300       0.700
## 56   commitment                          openness to experience                            1.000    63.000  16297.000                                                                                                                                                                         
## 57   others                              others                                            1.000    63.000  14120.000                                                                                                                                                                         
## 58   team effectiveness                  withdraw                                          1.000    62.000  20796.170    -0.482 (0.037)   -0.555   -0.410        -0.482       -0.482                      0.008               0.008               0.000                      1.000       0.000
## 59   demographics                        ksao                                              1.000    61.000  18590.000     0.238 (0.000)    0.238    0.238  -4865482.137  4865482.614                      0.005  14413837994438.000  14413837994438.000                      0.000       1.000
## 60   relational-oriented leader behavior withdraw                                          1.000    58.000  16611.000    -0.331 (0.075)   -0.477   -0.184        -0.460       -0.201                      0.000               0.011               0.010                      0.031       0.969
## 61   job involvement                     perception of support                             1.000    51.000  17571.000     0.430 (0.000)      NaN      NaN  -4306904.421  4306905.281                      0.001  11294275666916.301  11294275666916.301                      0.000       1.000
## 62   abusive supervision                 stress                                            2.000    48.000  14178.664     0.414 (0.054)    0.307    0.521         0.288        0.541                      0.001               0.011               0.010                      0.101       0.899
## 63   relational-oriented leader behavior team effectiveness                                1.000    48.000   4510.000     0.439 (0.072)    0.298    0.580         0.314        0.564                      0.001               0.010               0.010                      0.080       0.920
## 64   justice                             withdraw                                          2.000    47.000  12030.381    -0.160 (0.078)   -0.314   -0.007        -0.295       -0.026                      0.001               0.012               0.011                      0.109       0.891
## 65   satisfaction                        well-being                                        2.000    46.000  12021.801     0.410 (0.068)    0.278    0.543         0.191        0.630                      0.004               0.033               0.029                      0.122       0.878
## 66   ksao                                task performance                                  1.000    45.000   9829.000     0.456 (0.000)    0.456    0.456 -14449061.942 14449062.854                      0.009 127118032442426.000 127118032442426.000                      0.000       1.000
## 67   contextual performance              stress                                            1.000    43.000  11818.000    -0.434 (0.083)   -0.598   -0.271        -0.603       -0.266                      0.001               0.019               0.017                      0.073       0.927
## 68   contextual performance              organizational outcome                            1.000    42.000  11122.625     0.415 (0.050)    0.317    0.513         0.415        0.415                      0.005               0.005               0.000                      1.000       0.000
## 69   contextual performance              value-based and moral leader behavior             1.000    42.000  15885.000     0.458 (0.000)    0.458    0.458         0.458        0.458                      0.005               0.005               0.000                      1.000       0.000
## 70   contextual performance              well-being                                        1.000    42.000  11122.625                                                                                                                                                                         
## 71   demographics                        perception of support                             1.000    42.000  13530.000    -0.048 (0.027)   -0.101    0.005        -0.108        0.012                      0.001               0.003               0.002                      0.229       0.771
## 72   justice                             satisfaction                                      1.000    42.000  12001.839     0.510 (0.024)    0.462    0.558         0.488        0.533                      0.001               0.001               0.000                      0.734       0.266
## 73   contextual performance              task performance                                  1.000    40.000   3290.000     0.479 (0.049)    0.383    0.575         0.406        0.552                      0.001               0.005               0.003                      0.294       0.706
## 74   demographics                        motivation to work                                1.000    38.000  96269.000     0.042 (0.042)   -0.040    0.123        -0.081        0.165                      0.000               0.010               0.009                      0.038       0.962
## 75   satisfaction                        withdraw                                          1.000    38.000  12783.000    -0.556 (0.115)   -0.782   -0.331        -0.757       -0.355                      0.002               0.026               0.025                      0.066       0.934
## 76   motivation to work                  others                                            1.000    36.000   6987.000     0.150 (0.000)    0.150    0.150 -16066219.765 16066220.065                      0.004 157164785310695.000 157164785310695.000                      0.000       1.000
## 77   organizational outcome              motivation to work                                2.000    36.000   6671.000     0.305 (0.039)    0.228    0.383         0.305        0.305                      0.003               0.003               0.000                      1.000       0.000
## 78   organizational outcome              others                                            1.000    36.000   9533.679                                                                                                                                                                         
## 79   relational-oriented leader behavior well-being                                        1.000    36.000  15086.000     0.372 (0.028)    0.316    0.427         0.296        0.448                      0.001               0.005               0.004                      0.249       0.751
## 80   change-oriented leader behavior     change-oriented leader behavior                   1.000    33.000   8739.206     0.283 (0.228)   -0.163    0.730        -0.080        0.647                      0.001               0.082               0.080                      0.018       0.982
## 81   contextual performance              emerging state                                    2.000    33.000   4378.000     0.458 (0.150)    0.163    0.752         0.192        0.723                      0.003               0.046               0.043                      0.061       0.939
## 82   motivation to work                  neuroticism                                       1.000    31.000   5310.000     0.030 (0.311)   -0.580    0.640        -0.755        0.815                      0.006               0.381               0.375                      0.016       0.984
## 83   justice                             motivation to work                                1.000    28.000   7804.839     0.480 (0.060)    0.362    0.598         0.394        0.566                      0.001               0.006               0.004                      0.226       0.774
## 84   stress                              well-being                                        2.000    27.000  11720.244    -0.074 (0.032)   -0.136   -0.012        -0.099       -0.049                      0.006               0.006               0.000                      0.936       0.064
## 85   contextual performance              others                                            2.000    26.000   7319.839     0.390 (0.054)    0.283    0.497         0.390        0.390                      0.006               0.006               0.000                      1.000       0.000
## 86   task-oriented behavior              team effectiveness                                1.000    26.000   2982.000     0.371 (0.100)    0.175    0.567         0.195        0.546                      0.001               0.020               0.019                      0.057       0.943
## 87   commitment                          value-based and moral leader behavior             1.000    23.000   8825.000     0.575 (0.025)    0.527    0.624         0.539        0.612                      0.002               0.003               0.001                      0.746       0.254
## 88   job involvement                     well-being                                        2.000    22.000   6966.717     0.343 (0.035)    0.274    0.412         0.301        0.384                      0.005               0.006               0.001                      0.818       0.182
## 89   justice                             well-being                                        1.000    22.000   5826.137    -0.290 (0.120)   -0.525   -0.055        -0.503       -0.077                      0.001               0.029               0.028                      0.044       0.956
## 90   abusive supervision                 satisfaction                                      1.000    20.000   5296.488    -0.373 (0.024)   -0.420   -0.326        -0.373       -0.373                      0.001               0.001               0.000                      1.000       0.000
## 91   stress                              withdraw                                          1.000    20.000   6673.000     0.517 (0.047)    0.424    0.610         0.428        0.607                      0.002               0.007               0.005                      0.326       0.674
## 92   change-oriented leader behavior     commitment                                        1.000    19.000   7472.000                                                                                                                                                                         
## 93   well-being                          well-being                                        2.000    19.000   6246.366     0.274 (0.048)    0.180    0.368         0.274        0.274                      0.009               0.009               0.000                      1.000       0.000
## 94   perception of support               well-being                                        1.000    16.000   6421.473     0.336 (0.080)    0.179    0.492         0.232        0.439                      0.006               0.013               0.006                      0.487       0.513
## 95   task performance                    value-based and moral leader behavior             1.000    16.000   4322.000     0.343 (0.078)    0.189    0.497         0.193        0.493                      0.010               0.024               0.014                      0.425       0.575
## 96   abusive supervision                 task performance                                  1.000    15.000   3972.366    -0.135 (0.000)      NaN      NaN        -0.135       -0.135                      0.002               0.002               0.000                      1.000       0.000
## 97   abusive supervision                 withdraw                                          1.000    15.000   3972.366     0.240 (0.082)    0.078    0.401         0.240        0.240                      0.014               0.014               0.000                      1.000       0.000
## 98   perception of support               working experiences                               1.000    14.000   4139.000    -0.009 (0.025)   -0.058    0.039        -0.028        0.010                      0.001               0.001               0.000                      0.820       0.180
## 99   motivation to work                  well-being                                        1.000    12.000   4489.649     0.263 (0.080)    0.107    0.420         0.134        0.392                      0.002               0.012               0.010                      0.181       0.819
## 100  commitment                          organizational outcome                            1.000    11.000   2534.000     0.570 (0.054)    0.463    0.676         0.570        0.570                      0.006               0.006               0.000                      1.000       0.000
## 101  demographics                        demographics                                      1.000    11.000  11680.000    -0.012 (0.124)   -0.256    0.232        -0.228        0.204                      0.002               0.031               0.028                      0.079       0.921
## 102  emerging state                      team composition                                  1.000    11.000    768.000     0.000 (0.104)   -0.205    0.205         0.000        0.000                      0.120               0.120               0.000                      1.000       0.000
## 103  perception of support               relational-oriented leader behavior               1.000    11.000   2621.000     0.314 (0.044)    0.228    0.399         0.314        0.314                      0.004               0.004               0.000                      1.000       0.000
## 104  abusive supervision                 justice                                           1.000    10.000   2648.244    -0.344 (0.053)   -0.448   -0.241        -0.344       -0.344                      0.006               0.006               0.000                      1.000       0.000
## 105  organizational outcome              satisfaction                                      1.000    10.000   4392.000     0.216 (0.095)    0.030    0.402         0.050        0.382                      0.001               0.018               0.017                      0.066       0.934
## 106  well-being                          withdraw                                          1.000    10.000   2648.244    -0.231 (0.053)   -0.336   -0.127        -0.296       -0.167                      0.005               0.008               0.003                      0.668       0.332
## 107  team composition                    team process                                      1.000     9.000    530.000    -0.042 (0.103)   -0.243    0.160        -0.042       -0.042                      0.021               0.021               0.000                      1.000       0.000
## 108  job involvement                     stress                                            1.000     7.000   2666.649    -0.130 (0.094)   -0.314    0.054        -0.130       -0.130                      0.062               0.062               0.000                      1.000       0.000
## 109  organizational outcome              perception of support                             1.000     7.000   1701.000     0.409 (0.063)    0.286    0.531         0.332        0.486                      0.003               0.007               0.004                      0.460       0.540
## 110  perception of support               perception of support                             1.000     7.000   1303.000     0.191 (0.038)    0.117    0.266         0.191        0.191                      0.003               0.003               0.000                      1.000       0.000
## 111  commitment                          well-being                                        1.000     6.000   1588.946     0.302 (0.070)    0.166    0.439         0.196        0.409                      0.003               0.009               0.007                      0.266       0.734
## 112  job involvement                     value-based and moral leader behavior             1.000     6.000   3566.000     0.536 (0.040)    0.457    0.615         0.536        0.536                      0.003               0.003               0.000                      1.000       0.000
## 113  ksao                                perception of support                             1.000     5.000   2249.000    -0.016 (0.024)   -0.064    0.031        -0.016       -0.016                      0.001               0.001               0.000                      1.000       0.000
## 114  ksao                                value-based and moral leader behavior             1.000     5.000   1306.000     0.421 (0.100)    0.225    0.617         0.248        0.595                      0.002               0.020               0.018                      0.083       0.917
## 115  organizational outcome              task performance                                  1.000     5.000   1013.000     0.448 (0.100)    0.253    0.643         0.294        0.602                      0.005               0.020               0.014                      0.264       0.736
## 116  perception of support               value-based and moral leader behavior             1.000     5.000   1179.000                                                                                                                                                                         
## 117  change-oriented leader behavior     perception of support                             1.000     3.000   1148.000                                                                                                                                                                         
## ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────