Problem 1:
data(iris)
colors<- c('setosa' = 'skyblue', 'versicolor' = 'dodgerblue', 'virginica' = 'red')
shapes <- c('setosa' = 16, 'versicolor' = 17, 'virginica' = 18)
plot(iris$'Sepal.Width', iris$'Sepal.Length', type = 'n',
xlab = 'Sepal Width', ylab = 'Sepal Length', main = 'Iris Sepal Dimensions')
points(iris$Sepal.Width[iris$Species == 'setosa'], iris$Sepal.Length[iris$Species == 'setosa'],
col = colors['setosa'], pch = shapes['setosa'])
points(iris$Sepal.Width[iris$Species == 'versicolor'], iris$Sepal.Length[iris$Species == 'versicolor'],
col = colors['versicolor'], pch = shapes['versicolor'])
points(iris$Sepal.Width[iris$Species == 'virginica'], iris$Sepal.Length[iris$Species == 'virginica'],
col = colors['virginica'], pch = shapes['virginica'])
legend('topright', legend = names(colors), col = colors, pch = shapes, title = "Species")
Problem 2a and 2b: I worked on this for hours this week and I could not
get it. It will not let me publish this work if there are errors, so I
am happy to send a screen shot of what work I had if necessary for this
problem. I struggled with this lab quite a bit, so I had to watch some
Youtube videos on how to put the information into R.
Problem 3a: According to the answer being close to zero, the data is barely positively skewed but very close to symmetric.
data <- c(2413, 20310, 12637, 2753, 14505, 14440, 2379, 447, 345, 4784, 13803, 12668, 1235, 1257, 1671, 4041, 4145, 535, 5270, 3360, 3489, 1979, 2302, 807, 1772, 12807, 5427, 13147, 6288, 1803, 13167, 5343, 6684, 3508, 1549, 4975, 11249, 3213, 811, 3560, 7244, 6643, 8571, 13534, 4395, 5729, 14417, 4863, 1951, 13809)
mean_data <- mean(data)
sd_data <- sd(data)
skewness_data <- sum((data - mean_data)^3) / (length(data) * sd_data^3)
print(skewness_data)
## [1] 0.8461389
Problem 3b: This does not align with my answer in part a.This displays an unsymmetrical Histogram.
data <- c(2413, 20310, 12637, 2753, 14505, 14440, 2379, 447, 345, 4784, 13803, 12668, 1235, 1257, 1671, 4041, 4145, 535, 5270, 3360, 3489, 1979, 2302, 807, 1772, 12807, 5427, 13147, 6288, 1803, 13167, 5343, 6684, 3508, 1549, 4975, 11249, 3213, 811, 3560, 7244, 6643, 8571, 13534, 4395, 5729, 14417, 4863, 1951, 13809)
hist(data,
main = "Histogram of Data",
xlab = "Highest Point in each state in ft",
ylab = "number of states",
col = "lightblue")
Problem 3c: using more bins changes the way the skewness looks of a set
of data. The values are much more evenly distributed now that we added
mroe bins to the graph.
data <- c(2413, 20310, 12637, 2753, 14505, 14440, 2379, 447, 345, 4784, 13803, 12668, 1235, 1257, 1671, 4041, 4145, 535, 5270, 3360, 3489, 1979, 2302, 807, 1772, 12807, 5427, 13147, 6288, 1803, 13167, 5343, 6684, 3508, 1549, 4975, 11249, 3213, 811, 3560, 7244, 6643, 8571, 13534, 4395, 5729, 14417, 4863, 1951, 13809)
hist(data,
breaks = 15,
main = "Histogram of Data",
xlab = "Highest Point in each state in ft",
ylab = "number of states",
col = "deeppink")