-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFInalProject.R
More file actions
executable file
·72 lines (54 loc) · 1.46 KB
/
FInalProject.R
File metadata and controls
executable file
·72 lines (54 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#Final Project
#Nancy Torres
#Created on Tuesday, May 2, 2023
#Submitted on Saturday, May 6, 2023
library(datasets)
data("iris")
iris
?iris
#Question 1a:
unique(iris$Species)
#Question 1b:
nrow(iris)
#Question 1c:
Freq<-table(iris$Species)
Freq
#Question 1d:
colnames(iris)
#Question 1e:
summary(iris)
#Question 2a:
cor(iris$Petal.Length, iris$Petal.Width)
#Question 2b:
cor(iris$Sepal.Length, iris$Sepal.Width)
#The petal length and width are strongly positively correlated, whereas
#the Sepal length and width are slightly inversely correlated.
#Question 3:
#1)
AssoPetal<-plot(iris$Petal.Length, iris$Petal.Width, main = "Petals Scatter Plot",
xlab = "Petal Length", ylab = "Petal Width")
#2)
AssoSepal<-plot(iris$Sepal.Length, iris$Sepal.Width, main = "Sepals Scatter Plot",
xlab = "Sepal Length", ylab = "Sepal Width")
#Question 4:
#1)
install.packages("Ckmeans.1d.dp")
library(Ckmeans.1d.dp)
X = as.integer(as.factor(Ckmeans.1d.dp(iris$Petal.Width)$cluster))
X
#2)
Y = iris$Species
Y
#3)
XYtog<-table(X, Y)
#4) See attached statement
chisq.test(XYtog)
summary(XYtog)
#5)
Box<-boxplot(Petal.Width ~ Species, data=iris, main = "Problem 4.5 Box Plot",
xlab = "Species", ylab = "Petal Width")
#6)
#The three species can be distinguished based off their
#size of petal. For example, the Setosa has the smallest of the 3
#species petal width followed by the Veriscolor and
#the virginica has the largest petal width of all 3.