MIS 655 Grand Canyon University Understanding Mathematical Operations
MIS-655 Understanding Mathematical Operations and Descriptive Statistics in R
Directions: Use the information below to complete this assignment.
Part 1: Understanding Mathematical Operations in R
Within the R environment, complete the following mathematical computations:
- Compute the sum of 100, 200, 300, and 400.
- Compute the average of all even numbers from 2-100.
- Obtain the average for the square root of all multiples for even numbers from 2-100. Compute the square root of all even numbers from 2-100, and then average them.
- Create a series of four vector objects called WeeklyTemps*. Note that the * will be a 1, 2, 3, or 4. Store the temperatures for the past 4 weeks (i.e., 7 days, Monday-Sunday) in each object. You can reference weather resources for your area, or you can create the temperature data on your own.
- Combine the four vectors created in step 4 into a dataset called MonthlyTemperatures.
- Use the write() function to export the MonthlyTemperatures dataset into a .csv file called MonthlyTemperatures.
Part 2: Descriptive Statistics in R
This part of the assignment relies on the “Loblolly” dataset in the R environment. Hint: you can use the function data() to see all available datasets in R. You can use the function ?Loblolly or ?[any dataset name] to learn what the variables mean and their measurement scales.
- Load the Loblolly data into your R environment by storing it into an object called “lob.” Use the appropriate function to check the dimensions of the data frame (i.e., number of rows and columns).
- Use the appropriate functions to calculate the following values for each variable in the lob dataset.
- Maximum value
- Minimum value
- Standard deviation
- 75th % quartile
- Use the summary function on the data frame as well as on the height variable within the data frame. Describe the information that each summary provides as well as why you get different results when you apply the summary function to a data frame versus a variable within a data frame.
- Use the appropriate functions to determine whether there is a significant correlation between a Loblolly pine tree’s age and its height. Store the results of your correlation in an object called “age.height.cor.” Which correlational method is being used (e.g., Pearson, Spearman, Kendall) by the default correlation?
- Revise your code to specify that you want to run a Spearman correlation. Are your results the same or different than the default correlation? If so, how are they different?
- Use the hist and qqnorm functions to create a histogram and qq-plot for the height variable. Also run a Shapiro-Wilk test for normality. Is the data normally distributed? How can you tell? How do you interpret the results of the qq-plot and the Shapiro-Wilk test? How does the longitudinal structure of the data impact its distribution?