rand.test: Randomization Test

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

Description

Computes a randomization test for the number of significant correlations and the average absolute r between set1 and set2.

Usage

1
rand.test(set1, set2, sims = 1000, crit = 0.95, graph = TRUE, seed = 2)

Arguments

set1

A data.frame containing the variable(s) to be correlated with set2. Can be a single vector, but must be converted to a data.frame.

set2

A matrix or data.frame containing the variables to be correlated with set1.

sims

A numeric indicating the number of randomizations to be conducted.

crit

A numeric between 0.0 and 1.0 indicating the critical value at which you will reject the null hypothesis of no relation between set1 and set2.

graph

A logical indicating whether graphical output should be returned.

seed

A numeric specifying the random seed to be used. If set to FALSE, no seed is used.

Details

When correlating a single variable of interest or a set of variables with another set of other variables, one practical consideration is the number of correlations one would expect to find by chance and/or the average absolute r between the two sets of variables. Following Sherman and Funder (2009), this function empirically estimates the sampling distribution for the number of statistically significant correlations and the average absolute r.

Value

A list containing...

AbsR

A vector containing the results for the average absolute r between set1 and set2. Includes the N (for complete cases), the observed average absolute r, the expected average absolute r under a null hypothesis, the standard error of the average absolute r, the p-value of the observed average absolute r, the 99.9 percent upper and lower bound confidence intervals for the p-value, and the critical value for the test to be statistically significant.

Sig

A vector containing the results for the number of significant correlations between set and the set2. Includes the N (for complete cases), the observed number significant, the expected number significant under a null hypothesis, the standard error of the number significant, the p-value of the observed number significant, the 99.9 percent upper and lower bound confidence intervals for the p-value,and the critical value for the test to be statisttically significant.

Author(s)

Ryne A. Sherman

References

Sherman, R. A., & Funder, D. C. (2009). Evaluating correlations in studies of personality and behavior: Beyond the number of significant findings to be expected by chance. Journal of Research in Personality, 43, 1053-1063.

See Also

q.cor, ~~~

Examples

1
2
3
4
5
6
data(caq)
data(beh.comp)
head(caq)
head(beh.comp)
	#Note: In practice 'sims'=1000 is a better baseline
rand.test(caq,beh.comp,sims=100)

Example output

Loading required package: psych
Loading required package: abind
Loading required package: foreach
  sCAQ001 sCAQ002 sCAQ003 sCAQ004 sCAQ005 sCAQ006 sCAQ007 sCAQ008 sCAQ009
1       5       7       5       9       8       5       3       8       3
2       2       9       7       7       7       3       8       9       6
3       3       9       8       5       9       8       4       4       7
4       6       7       7       6       6       7       6       8       4
5       2       9       8       7       7       2       6       5       3
6       4       8       7       9       6       5       5       7       3
  sCAQ010 sCAQ011 sCAQ012 sCAQ013 sCAQ014 sCAQ015 sCAQ016 sCAQ017 sCAQ018
1       5       6       3       1       1       8       5       6       8
2       1       6       2       3       1       4       6       8       8
3       1       9       6       3       4       3       4       7       9
4       8       5       5       7       5       6       9       6       5
5       3       5       5       1       6       1       4       8       5
6       3       5       3       2       3       8       4       6       9
  sCAQ019 sCAQ020 sCAQ021 sCAQ022 sCAQ023 sCAQ024 sCAQ025 sCAQ026 sCAQ027
1       2       6       5       5       5       4       4       5       2
2       2       5       5       5       3       6       3       7       1
3       5       3       8       1       2       2       2       7       3
4       6       2       6       4       2       2       5       5       1
5       8       6       4       2       2       1       3       8       2
6       4       4       5       4       1       5       1       9       1
  sCAQ028 sCAQ029 sCAQ030 sCAQ031 sCAQ032 sCAQ033 sCAQ034 sCAQ035 sCAQ036
1       7       7       4       5       9       6       4       6       3
2       7       7       2       8       8       9       2       8       3
3       6       9       4       2       7       9       2       8       2
4       5       4       6       6       6       6       6       7       3
5       4       7       6       3       7       9       2       9       1
6       5       6       2       7       4       6       6       8       2
  sCAQ037 sCAQ038 sCAQ039 sCAQ040 sCAQ041 sCAQ042 sCAQ043 sCAQ044 sCAQ045
1       1       4       9       2       1       3       7       5       2
2       1       2       7       5       6       4       6       5       2
3       1       2       6       8       8       3       5       6       4
4       2       6       4       3       6       4       5       9       8
5       1       8       4       3       3       4       5       7       3
6       1       2       5       4       4       4       9       6       2
  sCAQ046 sCAQ047 sCAQ048 sCAQ049 sCAQ050 sCAQ051 sCAQ052 sCAQ053 sCAQ054
1       9       5       6       4       3       7       7       4       7
2       5       4       3       3       3       9       7       3       4
3       6       7       1       3       5       4       3       7       6
4       7       8       4       3       3       8       3       3       4
5       7       8       4       3       4       7       4       4       6
6       7       4       1       4       6       7       7       3       5
  sCAQ055 sCAQ056 sCAQ057 sCAQ058 sCAQ059 sCAQ060 sCAQ061 sCAQ062 sCAQ063
1       2       8       6       5       2       6       3       9       3
2       4       6       6       5       6       8       2       5       1
3       2       8       7       7       7       5       3       6       4
4       5       8       6       7       3       9       4       7       4
5       2       7       6       7       3       6       4       3       5
6       2       8       7       8       6       7       2       6       1
  sCAQ064 sCAQ065 sCAQ066 sCAQ067 sCAQ068 sCAQ069 sCAQ070 sCAQ071 sCAQ072
1       2       5       4       6       6       4       6       8       4
2       7       4       5       3       3       4       9       7       5
3       7       6       7       6       5       3       5       4       5
4       9       1       8       3       5       4       5       5       7
5       6       4       6       4       3       4       8       9       5
6       5       4       8       3       3       2       6       6       5
  sCAQ073 sCAQ074 sCAQ075 sCAQ076 sCAQ077 sCAQ078 sCAQ079 sCAQ080 sCAQ081
1       1       3       6       7       3       3       4       6       5
2       4       6       6       4       7       3       4       6       6
3       3       7       6       3       5       6       6       6       5
4       1       2       4       3       4       5       7       5       8
5       3       8       6       4       5       2       6       7       5
6       7       6       5       4       5       3       5       5       5
  sCAQ082 sCAQ083 sCAQ084 sCAQ085 sCAQ086 sCAQ087 sCAQ088 sCAQ089 sCAQ090
1       6       7       8       5       4       4       6       3       4
2       4       7       8       5       4       4       5       4       6
3       6       4       5       5       8       5       6       4       5
4       9       4       6       5       2       4       5       4       7
5       3       9       7       6       5       5       6       6       4
6       5       6       5       6       3       3       8       4       7
  sCAQ091 sCAQ092 sCAQ093 sCAQ094 sCAQ095 sCAQ096 sCAQ097 sCAQ098 sCAQ099
1       7       7       2       3       4       6       4       6       5
2       4       6       6       5       3       6       5       5       4
3       4       8       4       1       5       4       4       5       1
4       1       4       5       6       3       5       1       7       4
5       5       6       5       5       5       8       4       5       5
6       6       8       4       3       4       9       3       6       7
  sCAQ100
1       8
2       5
3       5
4       3
5       5
6       5
  compRBQ001 compRBQ002 compRBQ003 compRBQ004 compRBQ005 compRBQ006 compRBQ007
1       4.75       4.75       5.25       4.00       4.25       4.25       4.75
2       5.00       5.00       7.00       4.25       4.00       7.00       6.75
3       7.25       5.00       7.25       4.25       3.50       9.00       7.25
4       2.50       5.25       7.50       5.75       5.00       8.00       5.50
5       6.75       2.25       8.50       4.00       2.50       7.00       6.50
6       5.50       5.50       7.25       5.00       3.00       7.75       6.00
  compRBQ008 compRBQ009 compRBQ010 compRBQ011 compRBQ012 compRBQ013 compRBQ014
1       4.50       4.00       4.50       5.50       5.50       3.50       6.25
2       3.25       5.25       7.00       7.75       6.50       3.25       2.25
3       3.75       8.50       8.00       6.50       6.50       4.00       4.00
4       3.75       5.75       6.25       5.25       7.75       2.50       4.50
5       4.00       5.00       5.00       4.75       7.75       4.50       3.50
6       3.25       4.50       4.50       4.50       5.25       2.75       4.50
  compRBQ015 compRBQ016 compRBQ017 compRBQ018 compRBQ019 compRBQ020 compRBQ021
1       4.75       5.75       4.00       4.75       6.00       6.50       5.25
2       8.75       5.25       2.25       4.50       4.25       5.00       2.25
3       5.00       5.50       2.50       4.25       3.50       5.50       4.25
4       5.25       6.25       2.75       6.00       3.75       5.50       3.75
5       4.00       6.00       4.00       5.75       2.75       5.00       3.50
6       4.50       6.25       2.75       5.75       4.00       6.25       5.25
  compRBQ022 compRBQ023 compRBQ024 compRBQ025 compRBQ026 compRBQ027 compRBQ028
1       6.25       6.00       4.50       4.25       4.00       4.50       5.50
2       4.50       8.25       6.25       5.25       3.50       1.00       6.75
3       4.75       4.25       6.00       7.25       4.25       2.75       5.75
4       2.50       5.50       4.75       5.50       3.00       3.75       7.00
5       4.75       5.25       4.75       4.25       7.25       2.00       6.75
6       6.00       6.00       4.00       5.50       6.00       1.00       6.00
  compRBQ029 compRBQ030 compRBQ031 compRBQ032 compRBQ033 compRBQ034 compRBQ035
1       4.75       5.00       6.00       4.75       4.25       5.50       4.25
2       5.75       5.50       4.00       7.75       2.25       3.50       5.50
3       4.50       3.75       3.50       6.25       2.50       2.25       3.25
4       4.25       5.00       3.75       6.50       2.00       2.75       4.25
5       7.75       2.75       4.75       6.00       2.50       5.00       4.25
6       8.00       2.75       3.75       5.00       2.25       2.00       4.50
  compRBQ036 compRBQ037 compRBQ038 compRBQ039 compRBQ040 compRBQ041 compRBQ042
1       3.50       6.50       7.00       5.75       4.50       6.50       5.25
2       3.25       7.25       5.50       4.50       3.50       8.50       5.75
3       4.00       6.25       4.50       3.00       4.00       5.25       6.75
4       4.00       6.75       7.00       5.25       4.00       7.00       7.00
5       3.00       6.50       5.00       4.25       3.00       7.75       7.00
6       3.50       6.75       6.75       4.50       4.25       6.75       7.75
  compRBQ043 compRBQ044 compRBQ045 compRBQ046 compRBQ047 compRBQ048 compRBQ049
1       6.00       4.25       5.75       5.25       4.75       3.75       5.00
2       6.00       2.50       5.75       3.50       3.25       4.50       6.25
3       6.50       5.00       6.00       2.50       5.00       3.25       6.25
4       6.00       4.75       5.75       5.00       4.25       6.25       6.75
5       6.00       3.50       7.25       3.00       4.75       3.25       6.00
6       6.75       3.00       6.25       3.25       4.50       5.50       5.50
  compRBQ050 compRBQ051 compRBQ052 compRBQ053 compRBQ054 compRBQ055 compRBQ056
1       5.00       4.50       5.00        5.5       4.50       4.00       6.50
2       2.75       5.25       5.25        6.5       5.00       4.25       5.25
3       5.25       4.75       5.75        5.0       4.75       5.50       4.50
4       4.00       5.75       4.25        5.0       3.75       4.00       4.25
5       5.25       4.50       5.75        5.5       5.00       5.25       4.75
6       3.50       3.75       5.25        6.0       5.50       3.75       4.75
  compRBQ057 compRBQ058 compRBQ059 compRBQ060 compRBQ061 compRBQ062 compRBQ063
1       4.25       4.75       5.00       3.75       6.75       5.00       4.50
2       3.50       5.75       6.00       4.50       5.00       5.25       5.00
3       5.75       4.50       4.25       4.50       4.25       6.00       4.75
4       3.50       6.00       6.50       5.25       5.00       6.00       3.75
5       5.00       3.75       6.75       5.50       4.75       5.75       5.75
6       5.00       5.75       6.25       4.25       5.00       5.50       6.50
  compRBQ064 compRBQ065 compRBQ066 compRBQ067
1       5.75       4.75       6.00       3.50
2       6.50       4.75       4.50       3.75
3       5.75       4.25       6.25       4.75
4       6.00       4.00       5.25       4.00
5       7.00       3.25       5.25       5.00
6       8.00       5.50       5.25       3.75
$AbsR
                   Average Absolute r
N                            205.0000
Observed                       0.0699
Exp. By Chance                 0.0560
Standard Error                 0.0012
p                              0.0000
99.9% Upperbound p             0.0000
99.9% Lowerbound p             0.0000
95th %                         0.0581

$Sig
                   Number Significant
N                            205.0000
Observed                     790.0000
Exp. By Chance               336.1500
Standard Error                35.2143
p                              0.0000
99.9% Upperbound p             0.0000
99.9% Lowerbound p             0.0000
95th %                       389.6000

Warning message:
In rand.test(caq, beh.comp, sims = 100) :
  When p=.00, confidence interval for p not valid.

multicon documentation built on May 2, 2019, 3:18 a.m.