xpssCorrelations: Pearson product-moment correlations

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/xpssCorrelations.R

Description

R implementation of the SPSS CORRELATIONS function.

Usage

1
2
3
4
5
6
7
8
xpssCorrelations(x,
               variables = NULL,
               miss = list(alternative = "pairwise",
                         missings = "exclude"),
               print = list(test = "twotail",
                       level = "sig"),
               matrix = NULL,
               statistics = NULL)

Arguments

x

a (non-empty) data.frame or input data of class "xpss-Frame".

variables

atomic character or character vektor with the name of the variables.

miss

method which indicates what should happen when the data contain NAs. Default for alternative is 'pairwise', optionally listwise can be used as treatment for missings. The visualisation of the NAs can be specied via the argument missings. Default is 'exclude', optionally 'include' can be chosen to add missings in the statistics.

print

method which indicates what significnace level shall be used. Default significance test is 'twotail', optionally 'onetail' can be chosen. Default significance level is 'sig' to add significance asterisks, optionally 'nosig'.

matrix

exports the correlation matrix with observations, stddevs, means and variable names. Default is NULL.

statistics

method which enumerate the deskriptive statistics. Default is NULL. Optionally 'descriptives', 'xprod' or 'all' can be chosen.

Details

xpssCorrelations produces Pearson product-moment correlations with significance levels and, optionally, univariate statistics, covariances, and cross-product deviations.

Value

Returns a matrix of Pearson's r correlation.

Author(s)

Benjamin Piest

See Also

cor cor.test rcorr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
data(fromXPSS)



xpssCorrelations (fromXPSS,
                 variables =c("V5","V6","V7_2"))



xpssCorrelations (fromXPSS,
                 variables =c("V5","V6","V7_2") ,
                 miss = list(alternative = "pairwise",
                                missings = "exclude"),
                 print = list(test = "onetail",
                              level = "sig"),
                 statistics="all")



xpssCorrelations (fromXPSS,
                 variables =c("V5","V6","V7_2") ,
                 miss = list(alternative = "pairwise",
                                missings = "include"),
                 print = list(test = "onetail",
                              level = "sig"),
                 statistics="all")



xpssCorrelations (fromXPSS,
                 variables =c("V5","V6","V7_2") ,
                 miss = list(alternative = "listwise",
                                missings = "exclude"),
                 print = list(test = "twotail",
                              level = "sig"),
                 statistics="all")



xpssCorrelations (fromXPSS,
                 variables =c("V5","V6","V7_2"),
                 statistics = "all",
                 matrix = paste0(getwd(),"/correlations.txt"))

Example output

$Pearson_Correlation
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd       1                  -0.55*                    0.42 
Purchase Price in Dollar -0.55*               1                        0.02 
Weight                    0.42                0.02                     1    

$Sig_twotail
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd                          0.028                    0.109 
Purchase Price in Dollar 0.028                                        0.939 
Weight                   0.109               0.939                          

$N
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd                       20                       16     16
Purchase Price in Dollar                  16                       16     16
Weight                                    16                       16     16

$Note
                                                          
* .Correlation is significant at the 0.05 level (2-tailed)

$descriptive_statistics
                           mean    sd  N
Sales Volume in Tsd       53.81 69.07 20
Purchase Price in Dollar  32.94 19.20 16
Weight                   110.39 12.06 16

$Pearson_Correlation
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd       1                  -0.55*                    0.42 
Purchase Price in Dollar -0.55*               1                        0.02 
Weight                    0.42                0.02                     1    

$Sig_onetail
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd                          0.014                    0.054 
Purchase Price in Dollar 0.014                                        0.47  
Weight                   0.054               0.47                           

$Crossproduct
                         Sales Volume in Tsd Purchase Price in Dollar  Weight
Sales Volume in Tsd                 90641.05                -11892.35 5665.59
Purchase Price in Dollar           -11892.35                  5530.51   71.73
Weight                               5665.59                    71.73 2180.32

$Covariance
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd                  4770.58                  -792.82 377.71
Purchase Price in Dollar             -792.82                   368.70   4.78
Weight                                377.71                     4.78 145.35

$N
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd                       20                       16     16
Purchase Price in Dollar                  16                       16     16
Weight                                    16                       16     16

$Note
                                                          
* .Correlation is significant at the 0.05 level (1-tailed)

$descriptive_statistics
                          mean    sd  N
Sales Volume in Tsd      53.81 69.07 20
Purchase Price in Dollar 32.94 19.20 16
Weight                   86.80 59.61 19

$Pearson_Correlation
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd       1                  -0.55*                    0.25 
Purchase Price in Dollar -0.55*               1                        0.02 
Weight                    0.25                0.02                     1    

$Sig_onetail
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd                          0.014                    0.153 
Purchase Price in Dollar 0.014                                        0.47  
Weight                   0.153               0.47                           

$Crossproduct
                         Sales Volume in Tsd Purchase Price in Dollar   Weight
Sales Volume in Tsd                 90641.05                -11892.35 18780.57
Purchase Price in Dollar           -11892.35                  5530.51    71.73
Weight                              18780.57                    71.73 63959.16

$Covariance
                         Sales Volume in Tsd Purchase Price in Dollar  Weight
Sales Volume in Tsd                  4770.58                  -792.82 1043.36
Purchase Price in Dollar             -792.82                   368.70    4.78
Weight                               1043.36                     4.78 3553.29

$N
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd                       20                       16     19
Purchase Price in Dollar                  16                       16     16
Weight                                    19                       16     19

$Note
                                                          
* .Correlation is significant at the 0.05 level (1-tailed)

$descriptive_statistics
                           mean    sd  N
Sales Volume in Tsd       61.63 75.31 16
Purchase Price in Dollar  32.94 19.20 16
Weight                   110.39 12.06 16

$Pearson_Correlation
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd       1                  -0.55*                    0.42 
Purchase Price in Dollar -0.55*               1                        0.02 
Weight                    0.42                0.02                     1    

$Sig_twotail
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd                          0.028                    0.109 
Purchase Price in Dollar 0.028                                        0.939 
Weight                   0.109               0.939                          

$Crossproduct
                         Sales Volume in Tsd Purchase Price in Dollar  Weight
Sales Volume in Tsd                 85063.10                -11892.35 5665.59
Purchase Price in Dollar           -11892.35                  5530.51   71.73
Weight                               5665.59                    71.73 2180.32

$Covariance
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd                  5670.87                  -792.82 377.71
Purchase Price in Dollar             -792.82                   368.70   4.78
Weight                                377.71                     4.78 145.35

$Note
                                                          
* .Correlation is significant at the 0.05 level (2-tailed)

$descriptive_statistics
                           mean    sd  N
Sales Volume in Tsd       53.81 69.07 20
Purchase Price in Dollar  32.94 19.20 16
Weight                   110.39 12.06 16

$Pearson_Correlation
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd       1                  -0.55*                    0.42 
Purchase Price in Dollar -0.55*               1                        0.02 
Weight                    0.42                0.02                     1    

$Sig_twotail
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd                          0.028                    0.109 
Purchase Price in Dollar 0.028                                        0.939 
Weight                   0.109               0.939                          

$Crossproduct
                         Sales Volume in Tsd Purchase Price in Dollar  Weight
Sales Volume in Tsd                 90641.05                -11892.35 5665.59
Purchase Price in Dollar           -11892.35                  5530.51   71.73
Weight                               5665.59                    71.73 2180.32

$Covariance
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd                  4770.58                  -792.82 377.71
Purchase Price in Dollar             -792.82                   368.70   4.78
Weight                                377.71                     4.78 145.35

$N
                         Sales Volume in Tsd Purchase Price in Dollar Weight
Sales Volume in Tsd                       20                       16     16
Purchase Price in Dollar                  16                       16     16
Weight                                    16                       16     16

$Note
                                                          
* .Correlation is significant at the 0.05 level (2-tailed)

translateSPSS2R documentation built on May 30, 2017, 4:31 a.m.