Upload
others
View
9
Download
0
Embed Size (px)
Citation preview
Modeling Trends(Dose-Response Modeling)
Section 3.10 in Oehlert
Sections 8.1-8-4 in Dean, et al.
STAT:5201
Week 4: Lecture 2
1 / 42
Treatments as Doses
In some experiments, a ‘factor’ being used may actually havemeaningful numeric levels. In other words, the numbers used torepresent the levels can be seen as values on a continuous spectrum.
Meaningful numericFactor levels (doses)
Power 160, 180, 200, 220 (watts)
Drug 5, 10, 15 (mg)
Temperature 100, 110, 200, 210 (degrees)
We refer to such levels as doses.
When the factor levels are doses , we have more options for modelingthe mean structure. For example, a polynomial model in dose is anoption.
2 / 42
Treatments as Doses
Of course, not all factor levels have meaningful numeric levels. In theexample below, even though Litter is labeled numerically, the numbersare just an identifier.
Factor Levels
Litter 1,2,3,4,5,6
Drug A,B,C,D
The numbers in Litter simply designate a distinction between thelitters, not a real ordering of the litters. They could have been labeledas A through F.
The levels of Drug similarly just designate a distinction between thefour drugs being used in the experiment.
3 / 42
Treatments as Doses
Consider the following two data sets, each represents a 1-way ANOVAcompletely randomized design with Group as a dose (in milligrams).
Which data set is a better candidate for modeling the dose-responserelationship with a polynomial model? (i.e. Group as continuous)
0
20
40
60
5 10 15 20Group
y
group
5
10
15
20
Experiment 1
0
20
40
60
5 10 15 20Group
y
group
5
10
15
20
Experiment 2
4 / 42
Treatments as Doses
0
20
40
60
5 10 15 20Group
y
group
5
10
15
20
Experiment 1
0
20
40
60
5 10 15 20Group
y
group
5
10
15
20
Experiment 2
How many parameters are needed to model the mean structure in the‘full 1-way ANOVA model’? (NOTE: the ‘full model’ simplyestimates µi with the group mean, i.e. Yij = Yi ·).
How many parameters are needed for the mean structure inExperiment 2 if a quadratic is used?
What are the benefits if I can reasonably fit a ‘straight line’(y = β0 + β1x + ε) model instead of the full 1-way ANOVA model?
5 / 42
Treatments as Doses
0
20
40
60
5 10 15 20Group
y
group
5
10
15
20
Experiment 1
0
20
40
60
5 10 15 20Group
y
group
5
10
15
20
Experiment 2
Would you fit a linear or a quadratic polynomial to Experiment 2?How should we decide between the (1) full model, or (2) a quadratic,or maybe (3) a linear/straight-line model?
- We will compare the different model fits by considering the SSE foreach model. We’ll use full vs. reduced F -tests.
- SSE will go down for a more complex model, but it may not go downenough to justify using the extra parameters for the mean structure.
6 / 42
Treatments as Doses
Consider the data from Experiment 2.0
20
40
60
5 10 15 20Group
y
group
5
10
15
20
Experiment 2
We will compare the linear and quadratic polynomial models.
Let SSElinear be the SSE for the linear polynomial model(2 parameters for the mean structure).
Let SSEquad be the SSE for the quadratic polynomial model(3 parameters for the mean structure).
We know that SSEquad < SSElinear (even if the true relationship is linear).
The question is whether the decrease in SSE is worth the increasedcomplexity of the model (and using another df for the meanstructure).
7 / 42
Treatments as Doses
Consider the data from Experiment 2.0
20
40
60
5 10 15 20Group
y
group
5
10
15
20
Experiment 2
We will compare the different model fits by considering the SSE foreach model.
4SSE = SSElinear−SSEquad
Model 4 d .f . = 3− 2 = 1
To test the full vs. reduced model, we use Fo =
(4SSE4df
)(
SSEfulldffull
) =
(4SSE4df
)MSEfull
Under H0 true, when the reduced model is sufficient,Fo ∼ F(4df ,dffull ), and we will reject H0 if Fo > F(4df ,dffull ,1−α).
8 / 42
Treatments as Doses
If Fo > F(4df ,dffull ,1−α), then the 4SSE was larger than would havebeen expected if the reduced model was true, so there is evidenceagainst H0.
Example (linear vs. quadratic polynomial)
H0 : Linear fit is sufficient vs. HA : Quadratic complexity is needed
Fo =
(4SSE4df
)(
SSEfulldffull
) =(4SSE
1 )(SSEquaddfquad
) = 4SSEMSEquad
under H0, Fo ∼ F(1,dfquad )
In comparing full vs. reduced models, it is customary to start with themost complex model to be considered, use this as the ‘full model’,and compare to the next simpler model.
Dean, et al.(2017) calls these tests a ‘lack of fit (LOF)’ test, and callsthe SSEfull from the 1-way ANOVA the ‘pure error’.
9 / 42
Treatments as Doses
In Experiment 2, the most complex mean-structure model can befitted with a 1-way ANOVA model (4 parameters to describe themean structure).
The data have been collected for only 4 levels x = x1, x2, x3, x4 of thetreatment factor, so the fitted model Y = β0 + β1x + β2x
2 + β3x3
will pass through all the sample means Yi ·
Thus, the 1-way ANOVA and the cubic polynomial give the samefitted values (and SSE) when there are 4 levels to the dose factor.
0
20
40
60
5 10 15 20Group
y
group
5
10
15
20
Experiment 2
10 / 42
Treatments as Doses: Example
Example (1-way ANOVA 4 levels, with power as dose)
Factor: Power (160, 180, 200, 220 watts)Response: Etch rate in angstroms per minute
Five circuit wafers are randomly assigned to each power level. This is acompletely randomized design with g = 4, n = 5,N = 20.
11 / 42
Treatments as Doses: Example - full 1-way ANOVA model
Fit a 1-way ANOVA, the most complex mean structure to be fitted(i.e. g parameters to describe the mean structure).
Example (1-way ANOVA 4 levels, with power as dose)
The plot suggests a polynomial model may be a good option.12 / 42
Treatments as Doses: Example - full 1-way ANOVA model
Example (1-way ANOVA 4 levels, with power as dose)
ANOVA table output (full model):
We can compare the 1-way ANOVA model (same fitted values as thecubic polynomial in this case) to the quadratic (next simplerpolynomial model) using a full vs. reduced test and the SSE for eachrespective model.
13 / 42
Treatments as Doses: Example - Cubic vs. Quadratic
Example (1-way ANOVA 4 levels, with power as dose)
Fit a quadratic polynomial to the data (next simpler model).
Notice that power is no longer in the class statement, so it’s modeled asa continuous variable.
14 / 42
Treatments as Doses: Example - Cubic vs. Quadratic
Example (1-way ANOVA 4 levels, with power as dose)
H0: quadratic model is sufficient vs. HA: the cubic complexity is needed
For both models, the Total Sum of Squares∑
(Yij − Y··)2 is the same with
a value 72,209.75. We will use the SSE from each model to perform the‘lack of fit (LOF)’ F -test.
F0 =
(SSEquadratic−SSE1way ANOVA
1
)MSE1way ANOVA
= 5776.01−5339.2333.7 = 1.31
This F ratio is very close to 1 and is not significant (p-value = 0.2692)when compared to the null distribution of the test statistic F(1,16).
Thus, we accept the reduced model, and reject the overly complex 1-wayANOVA model (four separately estimated means, or cubic polynomial).
15 / 42
Treatments as Doses: Example - Quadratic vs. Linear
Example (1-way ANOVA 4 levels, with power as dose)
H0: linear model is sufficient vs. HA: the quadratic complexity is needed
Again, for both models, the Total Sum of Squares∑
(Yij − Y··)2 is the
same with a value 72,209.75. We will use the SSE from each model toperform the ‘lack of fit (LOF)’ F -test.
F0 =
(SSEquadratic−SSE1way ANOVA
1
)MSE1way ANOVA
= 5776.01−5339.2333.7 = 1.31
This F ratio is very close to 1 and is not significant (p-value = 0.2692)when considering the null distribution of the test statistic F(1,16).
Thus, we accept the reduced model, and reject the overly complex 1-wayANOVA model (four separately estimated means).
16 / 42
Treatments as Doses: Example - Quadratic vs. Linear
Example (1-way ANOVA 4 levels, with power as dose)
H0: linear model is sufficient vs. HA: the quadratic complexity is needed
F0 =
(SSElinear−SSEquadratic
1
)MSEquadratic
= 8352.46−5776.01339.77 = 7.58
The p-value is P(F(1,17) > 7.58) = 0.0136, so we reject H0 and choose thequadratic model for the data. The use of the extra parameter in thequadratic compared to the linear in the mean structure is worth it.
17 / 42
Treatments as Doses: Example - Quadratic fit
Example (1-way ANOVA 4 levels, with power as dose)
Diagnostic plots for constant variance and normality of errors fromquadratic fit:
18 / 42
Treatments as Doses: Example - Quadratic fit
Example (1-way ANOVA 4 levels, with power as dose)
And PROC GLM will also automatically give you a fitted curve withconfidence bands (perceiving ‘power’ as a continuous variable).
19 / 42
Treatments as Doses: Transformations
Sometimes it’s useful to apply a transformation to the data (either thedose or response) in order to simplify the dose-response relationship.
(see SAS example: Transformation in a dose-response)
We use the data from Oehlert Problem 3.3 as an example for thissituation, and you will do such a problem on your own in HW bydoing Problem 3.4 in Oehlert.
20 / 42
Transformation in a dose-response setting
Example (1-way ANOVA 5 levels, with factor as dose)
To study how resistant different types of vegetation are to ‘trampling’, parkresearchers randomly assigned 20 trails to one of five levels of ‘trampling’.
‘Trampling’ was quantified based on the number of walking passes thatwere taken over the trail. Trails either received 0, 25, 75, 200, or 500walking passes.
One year later, the average height of the vegetation on the trail wasmeasured as the response. This is a completely randomized design (CRD).
One-Factor experiment with levels as dosesFactor: Number of passes (0, 25, 75, 200, 500)Response: Height of vegetation (cm)
*Problem 3.3 on p.62 in Oehlert
21 / 42
Transformation in a dose-response setting
Example (1-way ANOVA 5 levels, with factor as dose)
22 / 42
Transformation in a dose-response setting
Example (1-way ANOVA 5 levels, with factor as dose)
23 / 42
Transformation in a dose-response setting
Example (1-way ANOVA 5 levels, with factor as dose)
Fit a 1-way ANOVA, the most complex model (same fitted values as aquartic polynomial in this case):
The lsmeans statement will provide the expected marginal mean foreach level of Passes.
24 / 42
Transformation in a dose-response setting
Example (1-way ANOVA 5 levels, with factor as dose)
25 / 42
Transformation in a dose-response setting
Example (1-way ANOVA 5 levels, with factor as dose)
26 / 42
Transformation in a dose-response setting
Example (1-way ANOVA 5 levels, with factor as dose)
Diagnostics for constant variance and normality.
27 / 42
Transformation in a dose-response setting
Example (1-way ANOVA 5 levels, with factor as dose)
Formally fit a quartic polynomial (same fitted values as 1-way ANOVA)
Notice that Passes is not in the class statement.28 / 42
Transformation in a dose-response setting
Example (1-way ANOVA 5 levels, with factor as dose)
The SS for the quartic model below look exactly the same as for the 1-wayANOVA model fit.
In the output, we also get a table of Type I SS and Type III SS includinga test for each predictor term in the model. Usually, Type III SS are thedesired tests (conditioning on all other terms in the model), but forpolynomials, the Type I SS (sequential SS) provides some usefulinformation.
29 / 42
Transformation in a dose-response setting
Type I SS
In Type I SS, the order in which terms are entered into the modelmatters. These SS are called sequential sums of squares. TheType I SS relates to the extra variability explained when a term isentered into the model after ONLY earlier entered terms have beenaccounted for.
Type III SS
The Type III SS relates to the extra variability explained when a termis entered into the model after ALL other terms have already beenentered. Order of entry makes no difference. These SS could becalled fully adjusted sums of squares.
30 / 42
Transformation in a dose-response setting
Type I SS and tests are computed based on ‘sequential sums’. InType I SS, the order in which terms are entered into the model affectsthe SS and tests. The order of entry for our model...
Height = Passes + Pass2 + Pass3 + Pass4
Where Passes was entered first, and Pass4 was entered last.
The Type I SS tells us how much that term adds to the model, afterall earlier entered terms have been accounted for.The test for Pass4 (i.e. x4) above, asks if x4 is a useful predictor afterx , x2, and x3 are already in the model. This is a useful test.The test for Passes (i.e. x) above, asks if x is a useful predictor afteronly accounting for an intercept.
31 / 42
Transformation in a dose-response setting
For most of our models, these Type I SS and tests are not of interest,but in the case of a polynomial, they can be useful.For instance, given that we’ve fitted a cubic to the data, should wealso add a quartic term? i.e. After accounting for Passes, Pass2, andPass3, is Pass4 useful in the model? The last Type I SS p-value inthe table tests for sufficiency of the cubic model compared to thequartic in this case.Based on the Type I SS output, it looks like we need the complexityof a quartic to describe the data (p=0.0014).NOTE: You would usually start at the bottom of the table and workyour way up if terms were not significant.
32 / 42
Transformation in a dose-response setting
But... the original plot does look like it shows a trend.
Example (1-way ANOVA 5 levels, with factor as dose)
Can we transform the doses (x-values) in order to create a more lineartrend?
33 / 42
Transformation in a dose-response setting
Example (1-way ANOVA 5 levels, with factor as dose)
We will first try a square root transformation on the x-values, then aquarter power transformation.
Looks like we need to bring the right tail in further to get a linearrelationship.
34 / 42
Transformation in a dose-response setting
Example (1-way ANOVA 5 levels, with factor as dose)
We will try a transformation as a power of 1/4.
Looks fairly linear. Let’s again fit our model and look at complexityusing the transformed x-values.
35 / 42
Transformation in a dose-response setting
Example (1-way ANOVA 5 levels, with factor as dose)
Fit a quartic polynomial to the x-transformed data and look atType I SS:
36 / 42
Transformation in a dose-response setting
Example (1-way ANOVA 5 levels, with factor as dose)
Fit a quartic polynomial to the x-transformed data.
Based on the Type I SS, it looks like a simple linear regression on thex-transformed data is sufficient.
37 / 42
Transformation in a dose-response setting
Example (1-way ANOVA 5 levels, with factor as dose)
Notice that the 1-way ANOVA table fitted on the original data(below) is the same as the 1-way ANOVA table for the x-transformeddata:
The Y -values were not altered, and there are still 5 distinct groups,each with a freely-fit mean.
38 / 42
Transformation in a dose-response setting
Example (1-way ANOVA 5 levels, with factor as dose)
Simple linear regression fit on the x-transformed data.
39 / 42
Transformation in a dose-response setting
Example (1-way ANOVA 5 levels, with factor as dose)
Simple linear regression fit on the x-transformed data.
Using transformed data always makes the interpretation a little moredifficult (scale change), but if it simplifies the relationship between thedose and response, it may be worth it.
40 / 42
Treatments as Doses
Example (1-way ANOVA 5 levels, with factor as dose)
VERIFY: The 1-way ANOVA model and quartic polynomial provide thesame fitted values. The predicted values were saved above for each foreach of the fitted models.
41 / 42
Treatments as Doses
Example (1-way ANOVA 5 levels, with factor as dose)The SAS System
Obs anovapred quarticpreds
1 18.000 18.000
2 18.000 18.000
3 18.000 18.000
4 18.000 18.000
5 12.000 12.000
6 12.000 12.000
7 12.000 12.000
8 12.000 12.000
9 11.975 11.975
10 11.975 11.975
11 11.975 11.975
12 11.975 11.975
13 9.000 9.000
14 9.000 9.000
15 9.000 9.000
16 9.000 9.000
17 8.000 8.000
18 8.000 8.000
19 8.000 8.000
20 8.000 8.00042 / 42