Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Summary Statistics: With any dataset, one of the first forms of exploratory analysis involves calculating summary statistics from the data like the five number

2. Summary Statistics: With any dataset, one of the first forms of exploratory analysis involves calculating summary statistics from the data like the five number summary: the minimum, median, third quartile, maximum and mean. We are also interested in the variation of a variable as measured by its standard deviation. One can use the summary() function to calculate a five number summary. The apply() function can be used to find the standard deviation of each row or column of a data frame or matrix structure. We note that the apply() function is very general as it can apply any other R command across rows or columns of a dataset. Here, we apply the sd() function across the columns (and then rows) of the iris dataset. Calculate these summary statistics of the iris dataset using the code below. #calculate the 5-number summary of the {\it iris} dataset five.num.summary <- summary(iris) #calculate the standard deviation across the first four columns of the dataset st.devs.cols <- apply(iris[,1:4], 2, sd) #calculate the standard deviation across the samples of the dataset st.devs.rows <- apply(iris[, 1:4], 1, sd) Now, we can vizualize the quantitative summary of the 4 variables by building a boxplot using the boxplot() command. Plot a boxplot using the following command: boxplot(iris[, 1:4], main = "Boxplot of Iris Variables") Questions (a) (5 points) How many of each species are there in the dataset? (b) (5 points) Which two variables have a median that is smaller than their corresponding mean? (c) (5 points) What is the standard deviation of the sepal length measurements? (d) (5 points) Calculate the 5-number summary and standard deviations of the subset you extracted earlier (subset.data). What is the standard deviation of the sepal length measurements for this subset

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Algebra And Trigonometry Enhanced With Graphing Utilities

Authors: Michael Sullivan, Michael Sullivan III

7th Edition

0134269039, 9780134269030

More Books

Students also viewed these Mathematics questions