编程代写 Math 558 Lecture #7

Math 558 Lecture #7

Testing assumptions
Recall from lecture 6 that we decomposed the total variability into two components. We used those components to test the difference between treatment means or whether the treatment effects are non zero. Also recall that we stated some assumptions that the error terms are required to follow for the validity of the analysis. These assumptions state that the errors are independently and normally distributed with mean 0 and variance σ2.

Copyright By PowCoder代写 加微信 powcoder

Testing assumptions
One way to test assumptions is to plot the graphs involving residuals. We defind the residuals as
e =y −yˆ iw iw iw
yˆ =μˆ+τˆ iw i
= μˆ + μˆ i − μˆ ̄
=μˆi = yi.
Examining the residuals can reveal a lot about the model adequacy.

Testing assumptions Constant variance
In order to test the assumption of constant variance we will graph ( scatter plot) the model residuals against the factor levels. This scatter plot can reveal the differences in the variability across different levels. By default R uses standardized residuals in the scatter plots.The standardized residual is the residual divided by its standard deviation.

Testing assumptions Residuals Vs factor levels
Constant Leverage: Residuals vs Factor Levels
Factor Level Combinations
Standardized residuals
-1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0

Testing assumptions Breusch-Pagan test
The Breusch-Pagan test is used to determine whether or not the equal variance assumption is met for our fitted model. The test uses the following null and alternative hypotheses:
Null Hypothesis (H0): the errors are distributed with equal variance Alternative Hypothesis (H1):the errors are not distributed with equal variance
studentized Breusch-Pagan test
data: Modal
BP = 5.4021, df = 2, p − value = 0.06713

Testing assumptions Residuals Vs fitted values
Residuals vs Fitted
5.5 6.0 6.5 7.0 7.5 8.0
Fitted values aov(Height ~ tf)
-2 -1 0 1 2

Understanding Residuals Vs fitted value
Generally speaking if the residuals are spread randomly around the 0 line the assumption that the relationship is linear is reasonable. If the residuals roughly form a “horizontal band” around the 0 line, this suggests that the variances of the error terms are equal. If no one residual “stands out” from the basic random pattern of residuals. This suggests that there are no outliers.

Testing assumptions Normal QQ plot
Normal Q-Q
-1.5 -1.0 -0.5 0.0 0.5 1.0 1.5
Theoretical Quantiles aov(Height ~ tf)
Standardized residuals
-1.0 -0.5 0.0 0.5 1.0 1.5 2.0

Shapiro-Wilk test of Normality
shapiro.test(residuals(Modal))
Shapiro-Wilk normality test
data: residuals(Modal) W = 0.93048, p-value = 0.3853

Conclusions
The change in time from 35 to 40 resulted in a significant rise in the height of the bread. The average height of the bread is 5.4125 for 35 minutes,8.2500 for 40 minutes and 8.3125 for 45 minutes. The F-ratio is significant at 5% level of significance.

Conclusions
By significant F-ratio we mean that not all treatment effects are zero or the treatment means are different for at least one pair of the means.This conclusion may not be of much practical use to the researcher. Therefore, in many cases the F-test is not particularly helpful in answering very specific questions like the following:
Are there differences in the effectiveness of different treatments? To respond to this question we can be interested in different sets of comparisons.
What is the relative effectiveness of treatments A and B?
Is there a linear relationship between the response and the treatments?
In order to respond to more specific questions we can extend the analysis of variance to the components.

Conclusions
We can be interested in τ1 − τ2 or τ1+τ2 − τ3+τ4 or τ1+τ2 − τ3. All these 2′22
quantities are the linear combinations of τi s. We have already discussed that the effect of any treatment is estimated by taking the mean of the observations related to that particular treatment and the overall mean (μi − μ).

Comparison among τ′s i
Any linear combination
lm = am1τ1 +am2τ2 +..amkτk
is called contrast if
am1 + am2 …….amk = 0
The combinations τ1 − τ2 and τ1+τ2 − τ3+τ4 are contrasts. 22

Orthogonality

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com