SOURCEBOOK

R | Data Analysis

Correlations

Prior to the steps below, enter the data as appropriate for the analyses (described elsewhere).

Obtaining Descriptive Statistics

Get the means and standard deviations for the variables.

mean(Outcome1)
sd(Outcome1)
mean(Outcome2)
sd(Outcome2)

Get the covariance and correlation matrix for the variables.

cov(Outcome1,Outcome2)
cor(Outcome1,Outcome2)

Obtaining Inferential Statistics

Get the correlation, its test for statistical significance, and its confidence interval.

cor.test(Outcome1,Outcome2)