# Final-Exam---Question-4-.docx - Final Exam Question 4 Van...

• 4
• 100% (21) 21 out of 21 people found this document helpful

This preview shows page 1 - 2 out of 4 pages.

Final Exam - Question 4 Van Thu Nguyen 2020-08-08 Loading Data data= read.csv ( '/Users/vnguy/Documents/Harrisburg University/ANLY 500/iris_exams.csv' ) df = data.frame (data) str (df) ## 'data.frame': 300 obs. of 6 variables: ## \$ id : chr "S001" "S002" "S003" "S004" ... ## \$ Species : chr "setosa" "setosa" "setosa" "setosa" ... ## \$ Sepal.Length: num 4.75 5.07 5.24 5.48 4.9 ... ## \$ Sepal.Width : num 3.3 3.68 3.44 3.96 2.81 ... ## \$ Petal.Length: num 1.44 1.21 1.59 1.53 1.49 ... ## \$ Petal.Width : num 0.235 0.111 0.405 0.272 0.345 ... Null Hypothesis H0 : Sepal.Length has no effect on Species (Setosa & Versicolor Only). That is to say that the difference between the observed Sepal.Length values for various Species are not statistically different Alternate Hypothese Ha : Sepal.Length has some effect on Species (Setosa & Versicolor Only). That is to say that the difference between the observed Sepal.Length values for various Species are in fact different from each other. Capture a t-test to compare the Sepal.Length of the Species (Setosa & Versicolor Only) from the iris dataset. newdf = subset (df, Species != "virginica" ) M = tapply (newdf \$ Sepal.Length, newdf \$ Species, mean) stdev = tapply (newdf \$