Skip to contents

Different types of correlations can be requested: PMC, Kendall tau rank correlation, Spearman rank correlation.

Usage

constructCor(
  x,
  method = c("pearson", "kendall", "spearman"),
  trim = 20,
  index = FALSE
)

Arguments

x

repgrid object.

method

A character string indicating which correlation coefficient is to be computed. One of "pearson" (default), "kendall" or "spearman", can be abbreviated. The default is "pearson".

trim

The number of characters a construct is trimmed to (default is 20). If NA no trimming occurs. Trimming simply saves space when displaying correlation of constructs with long names.

index

Whether to print the number of the construct.

Value

Returns a matrix of construct correlations.

See also

Examples


# three different types of correlations
constructCor(mackay1992)
#> 
#> ##############################
#> Correlation between constructs
#> ##############################
#> 
#> Type of correlation:  pearson 
#> 
#>                         1    2    3    4    5    6
#> Quick - *Slow       1     0.38 0.77 0.13 0.52 0.29
#> *Satisfied - Bitter 2          0.18 0.82 0.56 0.29
#> Talkative - *Quiet  3               0.14 0.72 0.58
#> *Succesful - Loser  4                    0.64 0.47
#> Emotional - *Calm   5                         0.92
#> *Caring - Selfish   6                             
constructCor(mackay1992, method = "kendall")
#> 
#> ##############################
#> Correlation between constructs
#> ##############################
#> 
#> Type of correlation:  kendall 
#> 
#>                         1    2    3    4    5    6
#> Quick - *Slow       1     0.38 0.77 0.00 0.46 0.15
#> *Satisfied - Bitter 2          0.08 0.40 0.54 0.15
#> Talkative - *Quiet  3               0.00 0.38 0.15
#> *Succesful - Loser  4                    0.64 0.39
#> Emotional - *Calm   5                         0.74
#> *Caring - Selfish   6                             
constructCor(mackay1992, method = "spearman")
#> 
#> ##############################
#> Correlation between constructs
#> ##############################
#> 
#> Type of correlation:  spearman 
#> 
#>                         1    2    3    4    5    6
#> Quick - *Slow       1     0.50 0.83 0.00 0.56 0.19
#> *Satisfied - Bitter 2          0.09 0.56 0.64 0.13
#> Talkative - *Quiet  3               0.00 0.39 0.21
#> *Succesful - Loser  4                    0.69 0.49
#> Emotional - *Calm   5                         0.81
#> *Caring - Selfish   6                             

# format output
constructCor(mackay1992, trim = 6)
#> 
#> ##############################
#> Correlation between constructs
#> ##############################
#> 
#> Type of correlation:  pearson 
#> 
#>               1    2    3    4    5    6
#> Qui - *Sl 1     0.38 0.77 0.13 0.52 0.29
#> *Sa - Bit 2          0.18 0.82 0.56 0.29
#> Tal - *Qu 3               0.14 0.72 0.58
#> *Su - Los 4                    0.64 0.47
#> Emo - *Ca 5                         0.92
#> *Ca - Sel 6                             
constructCor(mackay1992, index = TRUE, trim = 6)
#> 
#> ##############################
#> Correlation between constructs
#> ##############################
#> 
#> Type of correlation:  pearson 
#> 
#>                   1    2    3    4    5    6
#> (1) Qui - *Sl 1     0.38 0.77 0.13 0.52 0.29
#> (2) *Sa - Bit 2          0.18 0.82 0.56 0.29
#> (3) Tal - *Qu 3               0.14 0.72 0.58
#> (4) *Su - Los 4                    0.64 0.47
#> (5) Emo - *Ca 5                         0.92
#> (6) *Ca - Sel 6                             

# save correlation matrix for further processing
r <- constructCor(mackay1992)
r
#> 
#> ##############################
#> Correlation between constructs
#> ##############################
#> 
#> Type of correlation:  pearson 
#> 
#>                         1    2    3    4    5    6
#> Quick - *Slow       1     0.38 0.77 0.13 0.52 0.29
#> *Satisfied - Bitter 2          0.18 0.82 0.56 0.29
#> Talkative - *Quiet  3               0.14 0.72 0.58
#> *Succesful - Loser  4                    0.64 0.47
#> Emotional - *Calm   5                         0.92
#> *Caring - Selfish   6                             
print(r, digits = 5)
#> 
#> ##############################
#> Correlation between constructs
#> ##############################
#> 
#> Type of correlation:  pearson 
#> 
#>                            1       2       3       4       5       6
#> Quick - *Slow       1        0.37709 0.77226 0.12913 0.51682 0.28911
#> *Satisfied - Bitter 2                0.18383 0.81969 0.56239 0.28917
#> Talkative - *Quiet  3                        0.13771 0.71984 0.57656
#> *Succesful - Loser  4                                0.63623 0.47133
#> Emotional - *Calm   5                                        0.92394
#> *Caring - Selfish   6                                               

# accessing the correlation matrix
r[1, 3]
#> [1] 0.7722623