# optional; only if you want space for codingModule 3, Assignment 1: Comparing Two Means
Assignment Details
Purpose
The goal of this assignment is to assess your ability to compare means numerically, visually, and statistically
Task
Write R code which produces the correct answers and correctly interpret the results of visualizations and statistical tests.
Criteria for Success
- Code is within the provided code chunks
- Code chunks run without errors
- Code produces the correct result
- Code that produces the correct answer will receive full credit
- Code attempts with logical direction will receive partial credit
- Written answers address the questions in sufficient detail
Assignment Questions
In this assignment, we’re going to explore another data set on wind turbines that generate a significant portion of the energy for us down here in Antarctica.
Set-Up
Let’s load the tidyverse and read in the data set called wind_turbines.csv. Call the data turbines.
Explore the data set, either through the environment or through code. Answer the following questions (2 points):
- How many turbine companies are represented in the data?
- What do the data in each row of data represent?
Numeric
- Generate a summary of the data set that calculates the average required wind speed and mean power output for each wind turbine company. Save this as a data frame called
turbine_summary. (2 points)
Visual
Create a multiple histogram plot for the power output variable. (3 points)
- be sure to have a histogram for each turbine producer; the color and/or the fill should be determined by the maker of the turbine. They should also be transparent and not stacked vertically.
- set the number of bins to 10
- add in vertical lines for the mean values in the same color as the turbine makers (remember to reference the correct data frame!)
- make sure the x-axis, y-axis, and legend labels are capitalized and easier to understand
- use the
theme_classic()function
Generate a box-and-whisker plot that compares the required wind speed between different turbine makers (3 points).
The plot should:
- have capitalized and more descriptive axis labels (hint: wind speed is measured in km/hr, kilometers per hour.)
- show raw data points in addition to the boxes. The points should be jittered.
- use the
theme_classic()function
Statistic
- Write a null hypothesis and an alternative hypothesis for each question we are asking. (2 points)
Is there a significant difference in the power output from turbines from the different companies?
- Null Hypothesis (H0):
- Alternative Hypothesis (HA):
Is there a significant difference in the required wind speeds for turbines from different companies?
- Null Hypothesis (H0):
- Alternative Hypothesis (HA):
Based on the mean values in the
turbine_summarydata frame and the plots you’ve created above, predict the outcome of each t-test that we will run: (1) comparing wind speeds between turbine companies and (2) comparing power outputs between companies. (This question graded for completion, not accuracy; 2 points)Explain your reasoning (1-2 sentences for each t-test is fine).
Answer:
Perform a t-test to determine if there is a significant difference in the power output between turbine makers. (1 point)
In 2-3 sentences, interpret the output from Question 7. Focus on what the p-value is in reference to the cutoff of 0.05, what that means, and whether that means we reject or fail to reject the null hypothesis. (2 points)
Answer:
Perform another t-test, this time to determine whether the required wind speed differs significantly between manufacturers. (1 point)
In 2-3 sentences, interpret the output from Question 9; focus on the same ideas as in Question 8. (2 points)
Answer:
Turning in Your Assignment
- Make sure your name is filled in at the top of the document.
- Click the Render button at the top of this document. This will produce an HTML file that opens in a new tab and also saves to the Files panel on the bottom-right of your screen.
- To download the HTML file from Posit Cloud, click the empty box to the left of it in the Files panel.
- Click the blue gear at the top of the Files panel and choose Export.
- Put your last name at the front of the file name when prompted, then click Download. The file is now in your Downloads folder.