MASSACHUSETTS INSTITUTE OF TECHNOLOGY
Department of Civil and Environmental Engineering
1.017/1.010 Computing and Data Analysis for Environmental Applications /
Uncertainty in Engineering
Problem Set 9:
Twoway ANOVA and Regression
(Solutions provided at end of each
problem)
Due: Tuesday, Dec. 2, 2003
Please turn in a hard copy of your MATLAB program as well as all printed outputs (tables,
plots, etc.) required to solve the problem.
Problem 1
Continue your investigation of Massachusetts Water Resources Authority (MWRA) Boston
Harbor data by carrying out a two factor ANOVA which considers both rainfall and date.
For
Factor A (rainfall) your treatments should be the same three rainfall intensity categories used
in Problem Set 8.
For Factor B (date) use two treatments: 1) dates through 1991 and 2) dates
after 1991.
The dates are included in
the file lowercharles.txt
that you used in
Problem Set 8
.
You should use the internal MATLAB function
ANOVA2
to carry out your twofactor
analysis.
This function can handle treatments that have different numbers of replicates.
However, if you prefer to adopt the equal replicate assumption, you can force each treatment
to have the same number of replicates (as assumed in the lecture notes) by randomly selecting
the same number of measurements from the coliform population available for each treatment
combination.
As before, convert the coliform count
C
to the transformed count
C
T
=
ln
(
C
+1) and check for
normality.
Present the two factor ANOVA table, report the
p
value, and discuss the
significance of your results.
Problem 1 Solution
% Problem Set 9  Problem 1
clear all
close all
% edited lowercharles3 in excel: deleted unnecessary columns
% replaced blank rain with zeros
load lowercharles3.txt;
date=lowercharles3(:,1);
coli=log(lowercharles3(:,2)+1);
rain=lowercharles3(:,3);
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
p=1;
q=1;
r=1;
s=1;
u=1;
v=1;
for i=1:length(coli)
if rain(i)==0&date(i)<33790
T1(p)=coli(i);
p=p+1;
elseif rain(i)==0&date(i)>=33790
T4(s)=coli(i);
s=s+1;
elseif (rain(i)>0&rain(i)<=0.25)&date(i)<33790
T2(q)=coli(i);
q=q+1;
elseif (rain(i)>0&rain(i)<=0.25)&date(i)>=33790
T5(u)=coli(i);
u=u+1;
elseif rain(i)>.25&date(i)<33790
T3(r)=coli(i);
r=r+1;
elseif rain(i)>.25&date(i)>=33790
T6(v)=coli(i);
v=v+1;
end
end
number=min([(length(T1)), (length(T2)),
(length(T3)),(length(T4)), (length(T5)), (length(T6))]);
index1=randperm(length(T1));
ctreat1=T1(index1(1:number));
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '05
 GeorgeKocur
 Statistics, Normal Distribution, Regression Analysis, Environmental Engineering, li, Prediction interval

Click to edit the document details