Question: Please answer the following using SAS programming: Note1: For all questions below assume the test level is =0.05 Note2: Question that ask for a hypothesis
Please answer the following using SAS programming:
Note1: For all questions below assume the test level is =0.05
Note2: Question that ask for a hypothesis test make sure to follow these three steps: (1) Write down your null and alternative hypothesis clearly and mention which test is appropriate in your report, (2) Write a code in SAS to execute the test, and (3) provide the results in your report.
Note 3: This HW includes an appendix which is related to question 3. The appendix thoroughly explains the conceptual idea behind this question. I strongly recommend reading it.
Question 1
The United States Geological Survey provides data on earthquakes of historical interest. The SAS data set called EARTHQUAKES contains data about earthquakes with a magnitude greater than 2.5 in the United States and its territories. The variables are year, month, day, state, and magnitude.
California and Alaska are the two states with the highest number of earthquakes in the country. Create a new data set that includes only these two states. Also, assume that we are interested in the data between 2002 to 2011. After applying the above two changes, use this data set to answer the following questions:
- You are interested in the following statistics for the magnitude of earthquake:
- Mean
- Median
- Standard deviation
- Minimum and maximum
- 25th and 75th percentiles
Create one table that shows the above statistics across different states within each year. In particular, your table must have years at the first column, and it must break down the results across the two states in the second column.
(Hint: The general structure of your final output is shown in the following table)
| Year | State | Mean | StdDev | Min | P25 | Median | P75 | Max |
| 2002 | Alaska |
|
|
|
|
|
|
|
| California |
|
|
|
|
|
|
| |
| . |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
| 2010 | Alaska |
|
|
|
|
|
|
|
| California |
|
|
|
|
|
|
|
- Modify you SAS code in (a) such that the results for each year is shown in a separate table.
(Hint: The general structure of your final output is shown in the following table)
| Year= X | ||||||||
| Year | State | Mean | StdDev | Min | P25 | Median | P75 | Max |
| X | Alaska |
|
|
|
|
|
|
|
| California |
|
|
|
|
|
|
| |
- Now, assume you want to show the same results in part (b) but with the difference that years are shown is the first column and the states are shown in the top row.
(Hint: The general structure of your final output is shown in the following table)
| Year | State | |||||||||||||
| Alaska | California | |||||||||||||
| Mean | StdDev | Min | P25 | Median | P75 | Max | Mean | StdDev | Min | P25 | Median | P75 | Max | |
| 2002 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
| 2010 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- You are interested in how the magnitude of earthquakes is trending over time for each state. In one graph, plot two time series plots, side by side, which shows the trend of average magnitude of earthquakes over time for the two states.
- Test the following hypothesis: the average magnitude of earthquakes in California is significantly higher than that in Alaska. (Hint: Note that this is a one sided test. There are multiple ways to interpret a one sided test correctly. If you write down your null correctly for this question, then one way is to use the option sides=L)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
