SOURCEBOOK

R | Data Analysis

Confidence Intervals

Prior to the steps below, enter the data as appropriate for the analyses (described elsewhere). As always, the following commands should be typed directly in the R console window.

Obtaining Descriptive Statistics

Get the sample size, mean, and standard deviation for the variable.

length(Outcome)
mean(Outcome)
sd(Outcome)

Obtaining Inferential Statistics

Get the mean and its confidence interval.

t.test(Outcome)$conf.int

Also, you can change the width of the confidence interval if desired.

t.test(Outcome,conf.level=.99)$conf.int