1. Create an R script (*.R) file to test, from a sample of salary data for recent MBA
graduates, if the average salary of all recent MBA graduates is greater than the
average salary of last year’s MBA graduates according to the steps given below.
Give the script file a name that includes your first name and last name like this
Solution-W1-FirstName-LastName.R.
Complete these steps:
Step 1
Include these 3 lines of comments at the beginning of your R (*.R) script file to document
the script:
# Name: Elizabeth Abrams
# Course: MIS446
# Module: 5
Step 2
Read in the data set file jobs.csv Download jobs.csv that contains information about the
starting salaries (in $1000) of different positions of this year’s MBA graduates. Explore
the data.
1.
I.
II.
III.
Calculate the mean salary of all positions in the data file.
Calculate the standard deviation of all positions in the data file.
Display a histogram of the salary variable.
Your R code should be well commented and well organized to explain what the code
does.
Step 3
Enter this Sys.time() R function to print the current date and time and this
Sys.getenv(“username”) R function to print your username as shown here:
Step 4
The Director of Career Placement at a major management school claims that the average
starting salary of this year’s MBA graduates appears to exceed last year’s average of
$75,000. Use the data from the jobs.csv Download jobs.csvfile as a sample to test
H0 : � ≤ 75000 against Ha : � > 75000 at the � = 0:10 level.
Does the result of the test support the claim of the Director?
Your R code should be well commented and well organized to explain what the code
does.
Step 5
Enter this Sys.time() R function to print current date and time and this
Sys.getenv(“username”) R function to print your username as shown here:
2. Save and execute your *.R script file and display the results of its execution in the
RStudio console and/or the Plots tabs.
Take screenshots of your ordered steps to demonstrate successful completion of your
work. The screenshot should show the R commands you applied and the results you
obtained. Do not capture trial and error results. Only your final results should be
captured. Your screenshot(s) should look something like this:
3. Summarize your work on this assignment as follows:
o Explain how you completed this work and how you resolved the issues
you faced, if any.
o Explanation of your work should be relevant and detailed.
o Interpret the results you obtained from your work. Interpretation of
results should be relevant and accurate.
o Reflect on your experience with this assignment and the lessons you
learned. Reflection on experience should be relevant and personalized.
To submit your response to this assignment:
1. Prepare all the required *.R script file and screenshots.
2. Prepare your summary of your work (what you did, interpretation of results, and
reflection).
3. Use the Submission Template – Assignment.docx Download Submission Template
– Assignment.docxdocument and complete all its sections from your prepared
screenshots and work summary.
4. Make sure your completed Submission Template – Assignment document
o follows the order given in the submission template.
o
o
o
o
o
is at least 3-4 pages in length.
has embedded your *.R script file or you can submit your *.R script file
separately.
includes all screenshots in the same order of execution of your *.R
script.
meets the APA labeling requirements for tables, figures, (including
screenshots), code, and math.
conforms to CSU Global Guide to Writing and APA.
Submission Template – Assignment
Student Identifying Information
Name:
Course:
Module:
Date:
Embed Here Your R (*.R) Script File or Submit it Separately:
Insert Here APA-Titled and Ordered Screenshots of Steps:
Add Here APA-Styled Explanation of Your Work (200 words):
Add Here APA-Styled Interpretation of Your Results (200 word):
Add Here APA-Styled Reflection on Your Experience (200 words):
Position Salary in $1000
Accounting
84
Accounting
83
Accounting
80
Accounting
79
Accounting
86
Accounting
85
Accounting
82
Accounting
90
Accounting
91
Accounting
79
Accounting
89
Accounting
93
Finance
78
Finance
72
Finance
81
Finance
74
Finance
74
Finance
75
Finance
80
Finance
77
Finance
79
Finance
80
Finance
74
Finance
82
Management
68
Management
70
Management
72
Management
74
Management
66
Management
67
Management
70
Management
71
Management
66
Management
49
Management
68
Management
72
Marketing
68
Marketing
69
Marketing
67
Marketing
70
Marketing
69
Marketing
67
Marketing
96
Marketing
71
Marketing
69
Marketing
70
Marketing
Marketing
72
68
5.1 A Decision-Making Approach: Hypothesis Testing
A car manufacturer claims that their small truck gets 33 miles per gallon, on average. How do we test
such a claim using evidence? As another example, a company says that their stock price will grow at a
rate of $5 per week. Should we buy their stock? These are examples of hypotheses.
Hypothesis testing is a scientific way of checking if the best guess in research is correct. In statistical
hypothesis testing, regardless of the underlying testing methodology, the general procedure is the same.
It is composed of four generic steps, and they are:
Set up null and research (or alternative) hypotheses and select α-level (Type I error, usually at 5%).
Select and compute the test statistic.
Set up a decision rule.
Draw conclusion and summarize the significance.
The testing begins by considering two hypotheses. These are called the null and
alternative hypotheses. The null hypothesis (denoted by H0) is a statement about the
population that is believed to be true, and we denote this by H0. The alternative
hypothesis (denoted by Ha) is a claim about the population that is contradictory to H0.
A company has been in business for more than 70 years and has more than 7,000
employees. The company claims that the average tenure of their employees is 20
years. To determine if this statement is true, a random sample of 150 employees is
taken. The average tenure is found to be 20.4 years. It is known that the population
standard deviation is 2.53 years. Can the company continue to make this claim, or do
they need to change?
The null and alternative hypotheses are
H0: the average (or mean) tenure is 20 years, and
Ha: the average (or mean) tenure is not 20 years.
In probability theory, the Central Limit Theorem states that the sampling distribution of
the mean will be approximately normal when we have a large sample. Usually, for a
sample size greater than 30, one may use the Central Limit Theorem. This theorem
allows us to form a test statistic in a hypothesis testing problem. In the example above,
the sample mean follows a normal distribution with mean 20 years and standard
deviation 2.53/150. Then the test is computed as
where μ0 is the mean coming from H0, σ is the (population) standard deviation, and n is
the sample size. According to the Central Limit theorem, the z-score follows a standard
normal distribution if the sample size, n, is large enough (usually n>30).
Before we actually calculate the test statistic, we need to set up a decision rule to either
reject or fail to reject the null hypothesis. In many cases, we set α-level (or significance
level) equal to 0.05 (5%). What this means is that, under a standard normal distribution, if
the observed z-score is greater than 1.96 or less than -1.96, we would reject the null
hypothesis. Or, we fail to reject the null hypothesis if the observed z-score falls within
the interval (-1.96, 1.96).
(Source: Ray, 2015)
Since z = 1.94 is less than 1.96, we fail to reject (or retain) the null hypothesis. We can
also determine the p-value and make a decision. A p-value is defined as the probability
that the observed, or more extreme, results when the null hypothesis is true. Under a
normal distribution, this would just be a tail probability or a sum of tail probabilities (if
the hypothesis test is two-tailed). Once we determined the z-score, we can use
an online p-value calculatorLinks to an external site. to find the corresponding p-value.
We obtained the p-value associated with z = 1.94 equals 0.0524. The p-value type is
“two tails.” This is because, in the alternative hypothesis, average (or mean) tenure is not
20 years. This means that either average tenure is more than 20 years or less than 20
years. We are looking at both directions in a normal distribution. On the other hand, if
Ha: average tenure is more than 20 years then the p-value type is “right tail.” Similarly,
“left tail” is if it is less than 20 years.
To make a decision: If the p-value is less than the pre-specified α-level, we reject the null
hypothesis. Otherwise, we fail to reject to the null hypothesis. In the example, p-value =
0.0524 is greater than α-level of 0.05. Hence, we fail to reject the null hypothesis.
Once we make our decision, we need to interpret the decision in a context of the study. If we
reject the null hypothesis then there is a strong evidence for the claim. On the other hand, if we
fail to reject the null hypothesis then this does not mean that the statement in the null
hypothesis is true. In our example, we fail to reject the null hypothesis. This doesn’t necessarily
mean that the average tenure is 20 years at this company. It simply means that, from this random
sample, we failed to show that the average tenure is not 20 years. Hence, no significant
conclusion can be made when we fail to reject the null hypothesis.
R Studio Installation Instructions
1. Make sure you have already installed R (CRAN). Go to the R Studio download site:
https://www.rstudio.com/products/rstudio/download/#download
2. Select the installer for your operating system. The version numbers may vary, as they change
often. Download the installer to your computer. Save it to a location that you can find it.
3. Run the installer to begin the installation process.
4. Select Next to proceed.
5. Take the default installation location and select Next.
6. Select Install to continue with the installation.
7. The installation will proceed.
8. Select Finish. Your R Studio Installation is complete.