1.8

Q: What is replication? Why do we need replication in an experiment? Present an example that illustrates the difference between replication and repeated measurements.

R: Replication is an independent repeat run of each factor combination. We need replication in an experiment for two reasons: 1) Allows the experimenter to obtain an estimate of the experimental error. The experimental error becomes a basic unit of measurement for determining whether observed differences in the data are really statistically different. 2) If the sample mean is used to estimate the true mean response for one of the factor levels in the experiment, replication permits the experimenter to obtain a more precise estimate of this parameter.

1.9

Q: Why is randomization important in an experiment?

R: Randomization is important because statistical methods that are used in experimentation require that the observations (or errors) be independently distributed random variables.

2.21

The time to repair an electronic instrument is a normally distributed random variable measured in hours. The repair times for 13 such instruments chosen at random are as follows:

Hours <- (c(159,280,101,212,224,379,179,264,222,362,168,250,260))
Hours
##  [1] 159 280 101 212 224 379 179 264 222 362 168 250 260
  1. We wish to conduct a t - test to determine if the mean repair time exceeds 225 hours

H0: mu = 225

H1: mu > 225

Step 1: Calculate the mean hours to repair an electronic instrument

sample.mean <- mean(Hours)
print(c("sample.mean", sample.mean))
## [1] "sample.mean"      "235.384615384615"

Step 2: Calculate the standard error of the mean

sample.n <- length(Hours)
sample.n
## [1] 13
sample.sd <- sd(Hours)
sample.sd
## [1] 77.86477
sample.se <- sample.sd / sqrt(sample.n)
print(c("sample.se =", sample.se))
## [1] "sample.se ="      "21.5958027918587"

Step 3: Calculate the t-statistic for the test

t.stat <- (sample.mean - 225) / sample.se
print(c("t.stat", t.stat))
## [1] "t.stat"            "0.480862669691086"

Step 4: Calculate the p-value

degrees.freedom <- sample.n - 1
degrees.freedom
## [1] 12
p.value <- pt(q = t.stat, df = degrees.freedom, lower.tail = F)
print(c("One-sided p.value (less than test)", p.value))
## [1] "One-sided p.value (less than test)" "0.319631188711235"

Conduct a t-test to determine if the repair time is greater than 225 hours H0: mu = 225 H1: mu > 225

p.value <- pt(q = t.stat, df = degrees.freedom, lower.tail = F)
print(c("One-sided p.value (greater than test)", p.value))
## [1] "One-sided p.value (greater than test)"
## [2] "0.319631188711235"

Construct a 99 percent one-sided lower bound Confidence Interval for mean repair time

sample.mean <- mean(Hours)
print(sample.mean)
## [1] 235.3846
sample.n <- length(Hours)
sample.sd <- sd(Hours)
sample.se <- sample.sd / sqrt(sample.n)
print(sample.se)
## [1] 21.5958
alpha = 0.01
degrees.freedom = sample.n - 1
t.score = qt(p = alpha, df = degrees.freedom, lower.tail = TRUE)
print(t.score)
## [1] -2.680998
margin.error <- t.score * sample.se
lower.bound <- sample.mean - margin.error
print(lower.bound)
## [1] 293.2829

2.25

Type_1 <- c(65,81,57,60,82,80,67)
Type_1
## [1] 65 81 57 60 82 80 67
mean(Type_1)
## [1] 70.28571
var(Type_1)
## [1] 111.2381
Type_2 <- c(64,71,83,59,65,56,69)
Type_2
## [1] 64 71 83 59 65 56 69
mean(Type_2)
## [1] 66.71429
var(Type_2)
## [1] 78.90476
boxplot(Type_1)

t.test(Type_1, Type_2, mu = 0, conf.level = 0.95, alternative = "two.sided")
## 
##  Welch Two Sample t-test
## 
## data:  Type_1 and Type_2
## t = 0.68525, df = 11.663, p-value = 0.5066
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -7.820718 14.963576
## sample estimates:
## mean of x mean of y 
##  70.28571  66.71429
v <- ((var(Type_1)/7)+((var(Type_2)/7))^2/((var(Type_1)/7)^2/6)+((var(Type_2)/7)^2/6))
v
## [1] 40.08681
pt(0.68525, 40, lower.tail = FALSE)
## [1] 0.2485692
t.test(Type_1, Type_2, alternative = "two.sided", mu = 0, paired = FALSE, var.equal = FALSE, conf.level = 0.95)
## 
##  Welch Two Sample t-test
## 
## data:  Type_1 and Type_2
## t = 0.68525, df = 11.663, p-value = 0.5066
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -7.820718 14.963576
## sample estimates:
## mean of x mean of y 
##  70.28571  66.71429
qqplot(Type_1, Type_2,xlab = "Burning Times", ylab = "Chemical Flares", plot.it = TRUE)