Learn R Programming

statpsych (version 2.0.0)

test.spear: Hypothesis test for a Spearman correlation

Description

Computes a t test for a test of the null hypothesis that a population Spearman correlation is equal to 0, or a z test using a Fisher transformation for a test of the null hypothesis that a Spearman correlation is equal to some specified nonzero value. The hypothesis testing results should be accompanied with a confidence interval for the population Spearman correlation value (see ci.spear).

Usage

test.spear(cor, h, n)

Value

Returns a 1-row matrix. The columns are:

  • Estimate - estimated Spearman correlation (from input)

  • t or z - t test statistic (for h = 0) or z test statistic (for nonzero h)

  • p - two-sided p-value

Arguments

cor

estimated Spearman correlation

h

null hypothesis value of correlation

n

sample size

Examples

Run this code
test.spear(.471, .2, 100)

# Should return:
# Estimate       z       p
#     0.471 3.0096 0.00262


test.spear(.341, 0, 100)

# Should return:
#  Estimate     t df       p
#     0.341 3.591 98 0.00052


Run the code above in your browser using DataLab