case0401: Space Shuttle

Description Usage Format Source References See Also Examples

Description

The number of space shuttle O-ring incidents for 4 space shuttle launches when the air temperatures was below 65 degrees F and for 20 space shuttle launches when the air temperature was above 65 degrees F.

Usage

1

Format

A data frame with 24 observations on the following 2 variables.

Incidents

the number of O-ring incidents

Launch

factor variable with two levels—"Cool" and "Warm"

Source

Ramsey, F.L. and Schafer, D.W. (2013). The Statistical Sleuth: A Course in Methods of Data Analysis (3rd ed), Cengage Learning.

References

Feynman, R.P. (1988). What do You Care What Other People Think? W. W. Norton.

See Also

ex2011, ex2223

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
str(case0401)
attach(case0401)

mCool <- mean(Incidents[Launch=="Cool"]) 
mWarm <- mean(Incidents[Launch=="Warm"])
mDiff <- mCool - mWarm
c(mCool,mWarm,mDiff)  # Show the values of these variables

## PERMUTATION TEST , VIA REPEATED RANDOM RE-GROUPING (ADVANCED)
numRep  <- 50 # Number of random  groupings. CHANGE TO LARGER NUMBER; eg 50,000.   
rDiff   <- rep(0,numRep) # Initialize this variable to contain numRep 0s.
for (rep in 1:numRep) {  # Repeat the following commands numRep times:
  randomGroup <- rep("rWarm",24)  # Set randomGroup to have 24 values "rWarm"
  randomGroup[sample(1:24,4)]  <- "rCool"  # Replace 4 at random with "rCool"
  mW  <- mean(Incidents[randomGroup=="rWarm"]) # average of random "rWarm" group
  mC  <- mean(Incidents[randomGroup=="rCool"]) # average of random "rCool" group
  rDiff[rep] <- mC-mW  # Store difference in averages in 'rep' cell of rDiff
           }  # End of loop
hist(rDiff,  # Histogram of difference in averages from numRep random groupings
  main="Approximate Permutation Distribution",
  xlab="Possible Values of Difference in Averages",
  ylab="Frequency of Occurrence")
abline(v=mDiff)  # Draw a vertical line at the actually observed difference
pValue <- sum(rDiff >= 1.3)/numRep  # 1-sided p-value
pValue  
text(mDiff,75000, paste(" -->",round(pValue,4)), adj=-0.1) 

detach(case0401) 

Example output

'data.frame':	24 obs. of  2 variables:
 $ Incidents: int  1 1 1 3 0 0 0 0 0 0 ...
 $ Launch   : Factor w/ 2 levels "Cool","Warm": 1 1 1 1 2 2 2 2 2 2 ...
[1] 1.5 0.2 1.3
[1] 0

Sleuth3 documentation built on May 2, 2019, 6:41 a.m.