Announcements Review Thursday HW 9 Due Thursday Exam II Tuesday Similar in format to Exam I Pencil,...
-
Upload
adela-merritt -
Category
Documents
-
view
216 -
download
3
Transcript of Announcements Review Thursday HW 9 Due Thursday Exam II Tuesday Similar in format to Exam I Pencil,...
Announcements
• Review Thursday
• HW 9 Due Thursday
• Exam II Tuesday
• Similar in format to Exam I
• Pencil, Scantron, Reference Page
• Minimal Computation Required on Exam
• Today: Blocked ANOVA & 2-way ANOVA
Blocked ANOVA
• Recall blocking from the first part of class
• Create blocks - groups of similar individuals
• Want to account for differences due to intrinsic characteristics
• Randomly assign one member of each block to a treatment - a change in environment
• Example: Grocery Shelf Space and sales
• Each store has its own sales - depends on community
• Blocking will account for this effect
Grocery Example
• Compare how shelf space effects the sales of baking soda
• Treatments: Shelf space - 2 ft, 4 ft, 6 ft, 8 ft, 10 ft, 12 ft
• H0: 2 = … = 12
• = 0.05
• Blocks: 6 stores• Each store tries each
shelf space set-up for a week
• This results in one measurement (sale/week) for each shelf space-store combination
Grocery Example• The idea is to
measure the variability due to blocks (SS blocks), treatment (SS trt), and within (SS within)
• If SS treatment is much greater than SS within, then the shelf-space makes a difference
Sto
re N
o.
2 ft
spac
e
4 ft
spac
e
6 ft
spac
e
8 ft
spac
e
10 ft
spa
ce
12 ft
spa
ce
Sto
re M
ean
1 36 42 36 40 30 22 34.32 74 61 65 67 83 84 72.33 40 58 42 73 69 63 57.54 43 65 65 41 43 47 50.75 27 33 35 17 40 26 29.76 23 31 36 38 42 37 34.5
Space Mean 41 48 47 46 51 47 46.5 Overall Mean
• Computing the SSs, etc. in StataQuest Number of obs = 36 R-squared = 0.7762
Root MSE = 9.992 Adj R-squared = 0.6866
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 8655.00 10 865.50 8.67 0.0000
|
store | 8286.66667 5 1657.33333 16.60 0.0000
space | 368.333333 5 73.6666667 0.74 0.6022
|
Residual | 2496.00 25 99.84
-----------+----------------------------------------------------
Total | 11151.00 35 318.60
• F-Treatment = .74, p-value = 0, fail to reject H0!
• Shelf space does not affect baking soda sales• F-Block is not a real statistical test, but reflects the
effectiveness of blocking• If F-Block is >1, then blocking was effective, if F-
Block is < 1, then blocking was not effective• Blocking was effective
An Aside• Suppose I can play games with shelf space
and increase weekly sales of a store $100
• Suppose this is a chain with 1,000 stores
• That results in $5.2 million more in profits per year
• Yes - Statisticians do this type of thing - J.C. Penny is hiring now!
• Credit Cards’ advertising schemes are evaluated, etc.
Another Example: Energy Efficiency
• Four different A/C systems are to be compared for energy efficiency
• Other factors include: floor plan, size of house, amount of shade, etc.
• Block homes that are similar in these factors, and randomly give each house in a block a different A/C system (set to 70 F)
• Measure electricity usage for each house
Example: Energy Efficiency
• Results in this data set
• F Brand = 2.18, p-value = .1431
• Fail to reject equality of A/C system means
• F Block = 2.18, means that blocking helped
EnergyUsage
A/C system Block 1 Block 2 Block 3 Block 4 Block 5Brand A 116 118 97 101 115Brand B 171 131 105 107 129Brand C 138 131 115 93 110Brand D 144 141 115 93 99
Number of obs = 20 R-squared = 0.7755 Root MSE = 11.9202 Adj R-squared = 0.6445 Source | Partial SS df MS F Prob > F -----------+---------------------------------------------------- Model | 5889.85 7 841.407143 5.92 0.0037 | Block | 4959.70 4 1239.925 8.73 0.0015 Brand | 930.15 3 310.05 2.18 0.1431 | Residual | 1705.10 12 142.091667 -----------+----------------------------------------------------
Total | 7594.95 19 399.734211
$ome Practical Insights
• There may be a difference between A/C systems, but apparently other factors (shade, layout, etc.) make a bigger difference in energy usage
• This info comes in handy when planning a new facility - you can save on energy bills
• Again - the power of multiplication applies
Review of Blocked ANOVA• Blocking is used to
help avoid confounding
• Allows to see if there is a difference is due to treatment - an environmental manipulation
• Null hypothesis is always equivalence of treatment means
• Always one measurement per treatment-block combination
• SS-treatment, SS-block, and SS-error are computed for F-stats
• F-treatment tests equality of treatments
• F-block gives effectiveness of blocking (>1 effective)
Two-Way ANOVA
• Has similar structure to blocked ANOVA
• However, there are two factors
• More than one observation per treatment - treatment combination
• Has SS Factor A, SS Factor B, SS Interaction, and SS Within
• F tests for Interaction, Factor A, and Factor B
Example: Rats & Fats• Working for a chemical company wishes to
make rat poisoning
• Want to see how different ingredients affect how much a rat eats - also want to see if the taste preference depends on the sex of the rat
• Sample 12 rats - 6 males and 6 females
• Have two diets - “fresh fat” and “old fat”
• Randomly assign 3 males to each diet and 3 females to each diet
Example: Rats & Fats• Looks like males eat
more (sex effect)• Looks like fresh fat is
preferred by both sexes (diet effect)
• Is the difference between fresh and old fat the same for both sexes?
• If the answer to the above is no, then there is a sex-diet interaction
Fat TypeFresh Old709 538
Males 679 476699 592657 508
Females 594 505677 539
Daily Food Consumption
What conclusions about the population can be made based on the sample?
Example: Rats & Fats
• H0: no interaction, = .05
• H0: no sex diff, = .05• H0: no diet diff, = .05• Variability due to different
sources are measured with sums of squares and df
• SS Sex = 3780, df =1• SS Diet = 61204, df=1• SS Interact = 918, df=1• SS Within = 11666, df=8
• F Int = 0.63, p-val = .4503
• Fail to reject H0: no sex by diet interaction
• F Sex = 2.59, p-val = .1460
• Fail to reject H0: no sex difference in consumption
• F Diet = 42, p-val = .0002
• Reject H0: no diet difference
• The diet (type of fat) makes a difference in mean consumption for population
Example: Rats & Fats• The interaction must
be tested first for other tests to have any meaning
• Lines are approx parallel - an indication of no interaction
• Means (for each diet) are shown with error bars have no overlap - indicates a difference due to fat type
Example: Capsule Design
• Want to see how capsule design affects the time it takes for a pill to dissolve in two types of fluid: G & D
• Wish to compare two capsule designs: C & V
• Select several capsules of each type and randomly place them in one of the two fluids
• Measure the time it takes to dissolve
Example: Capsule Design
• H0: no interaction between capsule design and fluid type
• H0: no difference between fluid types
• H0: no difference between capsule types
• Set = .05 for all 3
• After obtaining the data, find the SSs, dfs, and F statistics for the three hypotheses
• The interaction must be tested first
• If we reject H0: no interaction, the other tests have no meaning
Example: Capsule Design
Number of obs = 20 R-squared = 0.4946
Root MSE = 5.48726 Adj R-squared = 0.3998
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 471.45 3 157.15 5.22 0.0105
|
caps | .20 1 .20 0.01 0.9361
fluid | 151.25 1 151.25 5.02 0.0395
interact | 320.00 1 320.00 10.63 0.0049
|
Residual | 481.759984 16 30.109999
-----------+----------------------------------------------------
Total | 953.209984 19 50.1689465
Example: Capsule Design
• F interaction = 10.63, p-val = .0049
• Reject H0: no interaction, conclude the difference in dissolve times between capsules depends on the fluid they are dissolved in
• Based on this statement, the other tests have no meaning
• You’re finished.
Example: Capsule Design• The interaction plot
makes indicates that the difference in dissolve times for the capsules may depend upon the fluid type - this is what is meant by an interaction
• Don’t test for differences in capsules or fluids - these have no meaning
• It doesn’t make sense to talk about which capsule is better overall - it depends on which fluid you’re talking about
Comparing the Two ANOVA’s
Blocked ANOVA• Has two factors - a
treatment and a block• Only one
measurement per combination
• Does not allow for testing interaction
• 3 SSs - block, treatment, within
Two-Way ANOVA• Has two factors - both
treatments• More than one
measurement per combination
• Allows for testing interaction
• 4 SSs - Factor A, Factor B, Interaction, Within
Review and Preview
• Next Class: Review for Exam II
• Numerical Data– Summary Stats
• Mean and SD - sensitive, easy to find samp. dist
• Median and SIQR - robust, hard to find samp. Dist
– Summary Graphs• Stem and Leaf - can reconstruct data, not aesthetic
• Histogram - aesthetic, appearance depends on bins
• Box Plots - good for side by side comparisons, detecting outliers
Review and Preview
• The t-distribution– Sample Mean is normally distributed (under
certain circumstances)– Convert to “z” to find p-values requires
knowledge of pop SD, which is unknown– Substituting sample SD for pop SD results in t-
distribution - accounts for extra variability– Resulted in one sample t-test and CI
Review and Preview
• Paired t and Two Sample t– Paired measurements can be reduced to single
measurement by taking differences– Paired t is one sample t on differences– Two sample t compares the means of two
populations using a sample from each
Review and Preview
• Normal Quantile Plots and Rank-Sum– Normal Quantile plot helps detect whether or
not a population is normal– Rank-Sum is an alternative to two-sample t
when we have small samples from non-normal populations
Review and Preview
• One Way ANOVA– Want to compare more than two population
means– Measure variability due to differences between
pops with SS between– Measure variability due to variation of each
population with SS within– F statistic determines if SS between is large
enough to say the pop means are different
Review and Preview
• Blocked ANOVA– Avoid confounding - create blocks– Have 3 SSs - SS blocks, SS treatment, SS
within– F-treatment tests for treatment differences– F-blocks is not a statistical test, but measures
effectiveness of blocking
Review and Preview
• Two-Way ANOVA– Compare two factors simultaneously– Allows testing for interaction– Has 4 SSs - Factor A, Factor B, Interaction,
Within– F stat for testing interaction, factor A, and
factor B– Interaction plots help with interpretation
Performing in StataQuest
Blocked ANOVA• Go to Statistics:
ANOVA: Two-way ANOVA
• Choose the factor and response variables
• Make sure the “include interaction” box is NOT checked
Two-Way ANOVA• Go to Statistics:
ANOVA: Two-way ANOVA
• Choose the factor and response variables
• Make sure the “include interaction” box IS checked
• Ask for an interaction plot