Learn R Programming

statpsych (version 1.7.0)

test.cor: Hypothesis test for a Pearson or partial correlation

Description

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

Usage

test.cor(cor, n, s, h)

Value

Returns a 1-row matrix. The columns are:

  • Estimate - estimate of correlation

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

  • p - two-sided p-value

Arguments

cor

estimated correlation

n

sample size

s

number of control variables

h

null hypothesis value of correlation

Examples

Run this code
test.cor(.484, 100, 0, .2)

# Should return:
# Estimate        z           p
#    0.484 3.205432 0.001348601


test.cor(.372, 100, 0, 0)

# Should return:
#  Estimate        t df           p
#     0.372 3.967337 98 0.000138436


Run the code above in your browser using DataLab