程序代写 Math 558 Lecture #6

Math 558 Lecture #6

Statistical Analysis CRD
We talked about two models for CRD.

Copyright By PowCoder代写 加微信 powcoder

Yiw = μi + εiw Yiw = μ + τi + εiw
The first one is the means model and the second one is the treatment effects or the fixed effects model. The parameter μ is common to all treatments called the overall mean. The parameter τi is unique to ith treatment called the ith treatment effect. With the help of treatment effects model (or the means model) we will estimate the treatment effects (or the treatment means).1
1Note that the treatment effects model is more widely used.

Analysis of the means model
There are two ways we can approach this analysis. The first approach is to test the equality of t treatment means. The appropriate hypothesis in this case is
H0 :μ1 =μ2 =….=μt
H1 : μi ̸= μj for at least one (i,j)
The second approach is to test the treatment effects to be zero for
i = 1, 2…t.

Analysis of the fixed effects model
In the effects model we will break the ith treatment mean in two components, μ + τi Where
μ = ∑ti=1 μi t
= t ∑(μ+τi)
= t ∑ μ + t ∑ τi
= μ + t ∑ τi
Which implies that ∑ti=1 τi = 0

Analysis of the means model
The appropriate hypothesis in this case is
H0 :τ1 =τ2 =….=τt
H1 :τi ̸=0 foratleastonei
Thus we either test the equality of means or the treatment effects being
equal to zero.

Decomposition of the total sum of squares
In order to test either of the above hypotheses we will perform analysis of variance. In the analysis of variance procedure we decompose the total variability into its components.
(y −y ̄..) = r(y ̄ −y ̄) + (y −yi.)
∑∑ij 2 ∑ii. ..2 ∑∑ij ̄2
i=1 w=1 i=1 i=1 w=1 TSS = SSTr + SSE
This equation represents the basic concept of ANOVA. This means that the total variability in the data can be partitioned into sum of the squares of the differences between the treatment averages and the overall average plus the sum of the squared differences of the observations within the treatments and the treatment averages.

ANOVA Table
treatments residuals
squares ∑ y2i. − sum2
Degrees of freedom
t-1 N-t N-1
Table: ANOVA
Mean Square
F ratio (variance ratio)
SSE= TSS-SSTr Total TSS
SSTr/t-1 MSTr/MSE) SSE/N-t

Calculations
loaf<-read.csv(file.choose(), header=TRUE) attach(loaf) > names(loaf)
“Time” “Height”
9.75 8.75 6.50 6.50 6.50 4.40 10.50 5.00 5.50 [10] 9.50 6.75 8.25 > Time
45 45 45 40 40 35 40 35 35 40 35 45
> tf<-factor(Time) 45 45 45 40 40 35 40 35 35 40 35 45 Levels: 35 40 45 > a<-sum(Height) > n<-length(Height) > ssm<-a2/n > sst<-sum(Height2) Calculations > tmean<-tapply(Height,tf,mean) # The tapply function creates group summaries according to factor > tsum<-tapply(Height,tf,sum) > trep<-tapply(Height,tf,length) 5.4125 8.2500 8.3125 21.65 33.00 33.25 35 40 45 9/14 Calculations > A<-sum(tsum2/trep) >A
> sstr<- A-ssm > ssr<-tss-A > dfTime<-length(tmean)-1 > dfTime
> dfresd<-n-length(tmean) Calculations > mstr<-sstr/2 > mstr 10.97687
> msr<-ssr/9 > msr 2.365417
> F<-mstr/msr >F

> Modal<-aov(Height tf, data=loaf) > summary(Modal)
Df tf 2 Residuals 9
Sum Sq 21.95 21.29
Mean Sq 10.977 2.365
F value 4.641
Pr(>F) 0.0412 *
Table: Caption
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 >

> coefficients(Modal) (Intercept) tf40 tf45
5.4125 2.8375 2.9000 sem1<-sqrt(msr/trep[1]) > sed1<-sqrt(msr*(1/trep[1]+1/trep[2])) > sed1

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