Inference for Two Samples In designed experiments, we compare the - - PowerPoint PPT Presentation

inference for two samples
SMART_READER_LITE
LIVE PREVIEW

Inference for Two Samples In designed experiments, we compare the - - PowerPoint PPT Presentation

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control Inference for Two Samples In designed experiments, we compare the distribution of some variable under various conditions, defined by the levels


slide-1
SLIDE 1

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Inference for Two Samples

In designed experiments, we compare the distribution of some variable under various conditions, defined by the levels of experimental factors. In the simplest case, there is only one factor, and it has just two levels. That is, we have samples from two populations, and we use those samples to make inferences about the differences between the populations.

1 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-2
SLIDE 2

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Comparing Means

The two samples are X1,1, X1,2, . . . , X1,n1 from population 1, and X2,1, X2,2, . . . , X2,n2 from population 2, assumed to be independent. Point estimator The natural unbiased estimator of µ1 − µ2 is ¯ X1 − ¯

  • X2. Its variance is

Var( ¯ X1 − ¯ X2) = σ2

1

n1 + σ2

2

n2 so its standard error is

  • σ2

1

n1 + σ2

2

n2 .

2 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-3
SLIDE 3

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Known variances If σ2

1 and σ2 2 are known, we can use the fact that

Z = ¯ X1 − ¯ X2 − (µ1 − µ2)

  • σ2

1

n1 + σ2

2

n2 ∼ N(0, 1) to construct confidence intervals for µ1 − µ2 and to test hypotheses about this difference, in exactly the same way as for the mean µ of a single population.

3 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-4
SLIDE 4

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Example: Paint formulations Population 1 is the drying time of a standard formulation of paint, and population 2 is the drying time for a modified formulation that is intended to dry more quickly. Sample sizes are n1 = n2 = 10, and we assume σ1 = σ2 = 8 minutes, so the standard error of ¯ X1 − ¯ X2 is (8

  • 2/10 = 3.58) minutes.

The sample means are ¯ x1 = 121 minutes and ¯ x2 = 112 minutes.

4 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-5
SLIDE 5

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Point estimate The point estimate of µ1 − µ2 is 9 minutes, with the standard error 3.58 minutes. Interval estimate The 95% confidence interval for µ1 − µ2 is 9 ± 1.96 × 3.58 = (1.98, 16.02) minutes.

5 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-6
SLIDE 6

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Hypothesis test The null hypothesis is that the new formulation dries no faster: H0 : µ2 ≥ µ1, or equivalently H0 : µ1 − µ2 ≤ 0, so the alternative is H1 : µ1 − µ2 > 0. The test statistic is zobs = ¯ x1 − ¯ x2 standard error = 9/3.58 = 2.516. The P-value is 1 − Φ(2.516) = 0.0059, so H0 is rejected in any test with Type I error rate α > 0.0059. The data give strong evidence that the new formulation dries faster.

6 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-7
SLIDE 7

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Unknown variances, assumed equal If the variances are unknown, but we assume that σ2

1 = σ2 2 = σ2, we

estimate the common variance σ2 with the pooled estimator S2

p = n1

  • i=1

(X1,i − ¯ X1)2 +

n2

  • i=1

(X2,i − ¯ X2)2 n1 + n2 − 2 = (n1 − 1)S2

1 + (n2 − 1)S2 2

(n1 − 1) + (n2 − 1) , a weighted average of S2

1 and S2 2.

7 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-8
SLIDE 8

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

The estimated standard error of ¯ X1 − ¯ X2 is Sp

  • 1

n1 + 1 n2 . The point estimator, interval estimator, and hypothesis tests are constructed in the same way as for a single population, with: The standard error replaced by the estimated standard error; The normal quantiles zα or zα/2 replaced by the corresponding t-quantiles tα,n1+n2−2 or tα/2,n1+n2−2; For a P-value, Φ(·) replaced by Ft,n1+n2−2(·).

8 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-9
SLIDE 9

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Example: Comparing mean yields Population 1 is the yield of a process using the current catalyst; Population 2 is the yield of the process using the an alternative, cheaper catalyst. Sample sizes are n1 = n2 = 8, and the sample means are ¯ x1 = 92.255, ¯ x2 = 92.733. Sample standard deviations are s1 = 2.39, s2 = 2.98, so sp =

  • 7 × 2.392 + 7 × 2.982

7 + 7 = 2.701.

9 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-10
SLIDE 10

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Point estimate We estimate µ1 − µ2 by ¯ x1 − ¯ x2 = −0.478 with estimated standard error sp ×

  • 2/8 = 1.351.

Note that catalyst 2 actually gives a higher mean yield, in addition to being cheaper. Interval estimate The 95% confidence interval for µ1 − µ2 is −0.478 ± t0.025,14 × 1.351 = (−6.271, 5.315).

10 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-11
SLIDE 11

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Hypothesis test Since the new catalyst is cheaper, we would switch to it unless it gives substantially lower yield. We would test the null hypothesis that its yield is no worse than the current catalyst; H0 : µ1 ≤ µ2 versus H1 : µ1 > µ2. Montgomery instead tests for no change; H0 : µ1 = µ2 versus H1 : µ1 = µ2. In either case, the test statistic is tobs = ¯ x1 − ¯ x2 estimated standard error = −0.478 1.351 = −0.35.

11 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-12
SLIDE 12

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

The two-sided P-value is 2(1 − Ft,14(| − 0.35|)) = 0.73, so H0 is not rejected at any conventional level. The data are consistent with the null hypothesis that there is no difference in mean yield, or in other words that changing the catalyst has no significant effect on mean yield.

12 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-13
SLIDE 13

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Comparing Variances

If we have samples of size n1 and n2 from N(µ1, σ2

1) and N(µ2, σ2 2),

we may need to decide whether the variances are equal. We could test H0 : σ2

1 = σ2 2 against H1 : σ2 1 = σ2 2, or, equivalently,

construct a confidence interval for σ2

1/σ2 2.

Both depend on the fact that F = s2

1/σ2 1

s2

2/σ2 2

follows the F-distribution with n1 − 1 and n2 − 1 degrees of freedom.

13 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-14
SLIDE 14

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Inference for Two Proportions

If we have samples of size n1 and n2 from Bernoulli populations with proportions p1 and p2, we may need to decide whether the proportions are equal. We assume that the normal approximations to the sampling distributions of ˆ p1 and ˆ p2 are good. We could test H0 : p1 = p2 versus H1 : p1 = p2, or construct a confidence interval for p1 − p2. In this case, these may not be exactly equivalent.

14 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-15
SLIDE 15

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Both the test and the confidence interval are based on the fact that Z = ˆ p1 − ˆ p2 − (p1 − p2)

  • p1(1 − p1)

n1 + p2(1 − p2) n2 is approximately N(0, 1).

15 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-16
SLIDE 16

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

In the hypothesis test, when p1 = p2 = p, the denominator is

  • p(1 − p)

1 n1 + 1 n2

  • which we estimate by replacing p with

ˆ p = n1ˆ p1 + n2ˆ p2 n1 + n2 . The test statistic is zobs = ˆ p1 − ˆ p2

  • ˆ

p(1 − ˆ p)

  • 1

n1 + 1 n2

  • 16 / 34

Inferences About Process Quality Statistical Inference for Two Samples

slide-17
SLIDE 17

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Continuity correction A continuity correction improves the approximation to the normal distribution: zobs = ˆ p1 − ˆ p2 − 1

2

  • 1

n1 + 1 n2

  • sgn(ˆ

p1 − ˆ p2)

  • ˆ

p(1 − ˆ p)

  • 1

n1 + 1 n2

  • .

Equivalently, replace x1 by x1 ± 1

2 and x2 by x2 ∓ 1 2, where the signs

are chosen to make zobs smallest. Montgomery does not give the corrected form, so you can use the uncorrected form from the previous slide for exercises.

17 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-18
SLIDE 18

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

For the confidence interval, we cannot assume that p1 = p2, so we estimate the denominator by

  • ˆ

p1(1 − ˆ p1) n1 + ˆ p2(1 − ˆ p2) n2 The confidence interval is ˆ p1 − ˆ p2 ± zα/2

  • ˆ

p1(1 − ˆ p1) n1 + ˆ p2(1 − ˆ p2) n2

18 / 34 Inferences About Process Quality Statistical Inference for Two Samples

slide-19
SLIDE 19

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

More Than Two Populations

We often work with factors with more than two levels, so that we have samples from more than two populations. Example: Tensile strength of paper Strength is influenced by percentage of hardwood fiber; experimental levels are 5%, 10%, 15%, and 20%, with 6 test specimens at each level. In R:

paper <- read.csv("Data/Table-04-04.csv") boxplot(Strength ~ Hardwood, data = paper)

19 / 34 Inferences About Process Quality More Than Two Populations

slide-20
SLIDE 20

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

We analyze data like these as if they were samples from N(µ1, σ2), N(µ2, σ2), N(µ3, σ2), and N(µ4, σ2). That is, normally distributed with a common variance σ2, and with 4 separate means µ1, µ2, µ3, and µ4. We rewrite the 4 means in a way that will be very convenient in more complicated models: µi = µ + τi, i = 1, 2, 3, 4. We now have 5 parameters, but only 4 samples, so we must impose a constraint: In the text, 4

i=1 τi = 0;

In R, τ1 = 0.

20 / 34 Inferences About Process Quality More Than Two Populations

slide-21
SLIDE 21

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

In R:

paperLm <- lm(Strength ~ factor(Hardwood), data = paper) summary(paperLm)

Partial output:

Residuals: Min 1Q Median 3Q Max

  • 3.667 -2.042

0.000 1.458 5.000 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 10.000 1.041 9.602 6.24e-09 *** factor(Hardwood)10 5.667 1.473 3.847 0.001005 ** factor(Hardwood)15 7.000 1.473 4.753 0.000122 *** factor(Hardwood)20 11.167 1.473 7.581 2.65e-07 ***

  • Signif. codes:

0 *** 0.001 ** 0.01 * 0.05 . 0.1 1

21 / 34 Inferences About Process Quality More Than Two Populations

slide-22
SLIDE 22

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

The line labeled (Intercept) gives information about µ, especially that ˆ µ = 10.000 with standard error 1.041. The next three lines, labeled factor(Hardwood)10 and so on, give information about the τs, each with the estimate and its standard error. The columns headed t value and Pr(>|t|) are for testing the null hypothesis that the corresponding parameter is zero, and are not useful in this case.

22 / 34 Inferences About Process Quality More Than Two Populations

slide-23
SLIDE 23

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

The first question is always “does this factor have any effect on the response?” We test H0 : µ1 = µ2 = µ3 = µ4 against the alternative that at least

  • ne pair of µs is unequal.

In the µ, τ formulation, the null hypothesis is H0 : τ1 = τ2 = τ3 = τ4 = 0. Partial output:

Residual standard error: 2.551 on 20 degrees of freedom Multiple R-squared: 0.7462,Adjusted R-squared: 0.7082 F-statistic: 19.61 on 3 and 20 DF, p-value: 3.593e-06

The F-statistic tests that hypothesis, and here it is strongly rejected (P = 3.6 × 10−6); not surprising, given the boxplots.

23 / 34 Inferences About Process Quality More Than Two Populations

slide-24
SLIDE 24

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Residuals The jth observation for the ith treatment is yi,j, the corresponding fitted value is ˆ yi,j = ˆ µ + ˆ τi, and the residual is ei,j = yi,j − ˆ yi,j. We examine the residuals to detect departures from the model assumptions. In R:

plot(paperLm)

24 / 34 Inferences About Process Quality More Than Two Populations

slide-25
SLIDE 25

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

The four plots: Residuals versus fitted values; not very useful in this case; Q-q plot of residuals; detects departure from normality; Absolute values of residuals (square root scale) versus fitted values; detects variance that changes with the mean; Residuals versus factor levels; detects variance that is affected by factor levels, not necessarily through the mean.

25 / 34 Inferences About Process Quality More Than Two Populations

slide-26
SLIDE 26

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Linear Regression Models

When a response Y is related to a quantitative factor x, such as the percentage hardwood in the paper strength example, we may want to describe the relationship in a regression model: E(Y ) = β0 + β1x, Var(Y ) = σ2. Equivalently, if we write ǫ = Y − E(Y ) the model is Y = β0 + β1x + ǫ, where E(ǫ) = 0 and Var(ǫ) = σ2.

26 / 34 Inferences About Process Quality Linear Regression Models

slide-27
SLIDE 27

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

More generally, the response may be influenced by several factors; the model becomes E(Y ) = β0 + β1x1 + β2x2 + · · · + βkxk. Suppose we have n observations, where for i = 1, 2, . . . , n the response yi has associated factor values xi,1, xi,2, . . . , xi,k. The least squares estimates ˆ β0, ˆ β1, . . . , ˆ βk are found by minimizing L(β0, β1, . . . , βk) =

n

  • i=1
  • yi −
  • β0 +

k

  • j=1

βjxi,j 2 .

27 / 34 Inferences About Process Quality Linear Regression Models

slide-28
SLIDE 28

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

The fitted values are ˆ yi = ˆ β0 + ˆ β1xi,1 + · · · + ˆ βkxi,k, i = 1, 2, . . . , n. and the residuals are ei = yi − ˆ yi, i = 1, 2, . . . , n The residual sum of squares is SSE =

n

  • i=1

e2

i = L(ˆ

β0, ˆ β1, . . . , ˆ βk).

28 / 34 Inferences About Process Quality Linear Regression Models

slide-29
SLIDE 29

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

We can show that E(SSE) = (n − p)σ2, where p = k + 1 is the number of β-parameters, including the intercept β0. So ˆ σ2 = SSE n − p is an unbiased estimator of σ2.

29 / 34 Inferences About Process Quality Linear Regression Models

slide-30
SLIDE 30

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Example: Tensile strength of paper Previously we assumed that the four means µi were separate parameters: µ1 = µ + τ1, and so on, with some constraint on the τs, but no particular structure. We could instead assume the linear regression model E(Yi) = β0 + β1xi where xi is the percentage of hardwood for the ith specimen: 5% for the first 6 observations, 10% for the next 6, and so on.

30 / 34 Inferences About Process Quality Linear Regression Models

slide-31
SLIDE 31

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

In R:

paperReg <- lm(Strength ~ Hardwood, data = paper) # not factor(Hardwood) summary(paperReg)

Output:

Residuals: Min 1Q Median 3Q Max

  • 3.7333 -1.8458 -0.2167

1.4292 4.7833 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 7.25000 1.30100 5.573 1.33e-05 *** Hardwood 0.69667 0.09501 7.332 2.43e-07 ***

  • Signif. codes:

0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 2.602 on 22 degrees of freedom Multiple R-squared: 0.7096,Adjusted R-squared: 0.6964 F-statistic: 53.76 on 1 and 22 DF, p-value: 2.43e-07

31 / 34 Inferences About Process Quality Linear Regression Models

slide-32
SLIDE 32

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Example: Operating Cost Operating cost of a branch office of a finance company: Response Y is cost; Factor x1 is number of new loan applications; Factor x2 is number of loans outstanding. In R:

finance <- read.csv("Data/Table-04-10.csv") pairs(finance) # syntax: 2 factors separated by "+": financeReg <- lm(Cost ~ New + Out, data = finance) summary(financeReg)

32 / 34 Inferences About Process Quality Linear Regression Models

slide-33
SLIDE 33

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Output:

Call: lm(formula = Cost ~ New + Out, data = finance) Residuals: Min 1Q Median 3Q Max

  • 21.4972 -13.1978
  • 0.4736

10.5558 25.4299 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1566.0778 61.5918 25.43 1.80e-12 *** New 7.6213 0.6184 12.32 1.52e-08 *** Out 8.5848 2.4387 3.52 0.00376 **

  • Signif. codes:

0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 16.36 on 13 degrees of freedom Multiple R-squared: 0.927,Adjusted R-squared: 0.9157 F-statistic: 82.5 on 2 and 13 DF, p-value: 4.1e-08

33 / 34 Inferences About Process Quality Linear Regression Models

slide-34
SLIDE 34

ST 435/535 Statistical Methods for Quality and Productivity Improvement / Statistical Process Control

Regression Diagnostics As before, we can use plot(financeReg) to make four residual plots. The first shows the residuals against the fitted values, and in a regression model it can detect an incorrect model. The q-q plot and the scale-location plot can show departures from normality and from constant variance, respectively. The fourth plot now shows leverage (“hat values”) and influence (“Cook’s D”).

34 / 34 Inferences About Process Quality Linear Regression Models