lab_ (2) - JupyterLab
pdf
keyboard_arrow_up
School
University of Lethbridge *
*We aren’t endorsed by this school
Course
STAT-1770
Subject
Industrial Engineering
Date
Jan 9, 2024
Type
Pages
8
Uploaded by GrandSnowWildcat39
Lab 7 Assignment
Lab 7 Assignment is due on Friday November 10 at 8:00 pm.
Complete this notebook, by introducing and executing the
required code and answering the related questions.
When you have finished your work and wish to submit your
assignment, download this notebook as a pdf file File > Save
and Export Notebook As > PDF or File > Print > Save as PDF.
Submit the pdf file to Lab 7 Assignment in Crowdmark.
You can copy, paste, and modify code from previous labs if
you wish, as opposed to writing code from scratch. Open the
previous lab and highlight the code you want. Then copy and
paste the code into this assignment and make the necessary
modifications.
If you have questions, please ask.
Load Data:
Data Information:
Data Set:
Name:
gpa_study_hours
Variables:
The variables included in the dataset are
gpa
: Grade point average (GPA) of student.
study_hours
: Number of hours students study per week.
GPA and Study Hours among university students
In [1]:
download.file
(
"http://www.openintro.org/data/rda/gpa_study_hours.rda"
,
destfile
=
"g
load
(
"gpa_study_hours.rda"
)
GPA and study hours were gathered for a random sample of 193 undergraduate university
students.
Let's have a quick look at the data
A tibble: 6 × 2
gpa
study_hours
<dbl>
<dbl>
1
4.00
10
2
3.80
25
3
3.93
45
4
3.40
10
5
3.20
4
6
3.52
10
Suppose we wish model GPA and study hours using the normal distribution. To begin, we
should examine GPA and study hours to determine whether the normal distribution seems
an appropriate model in each case.
Exercise 1: Construct a histogram of the GPA,
gpa
, data. You
only need a histogram. You do not need to include a density
curve.
(2 marks)
In [6]:
head
(
gpa_study_hours
)
In [2]:
hist
(
gpa_study_hours
$
gpa
)
Exercise 2: Construct a histogram of the study hours,
study_hours
, data. You only need a histogram. You do not
need to include a density curve.
(2 marks)
In [3]:
hist
(
gpa_study_hours
$
study_hours
)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Exercise 3: Use the
qqnorm
and
qqline
functions to
construct a normal probability plot of the GPA,
gpa
, data.
(2 marks)
In [4]:
qqnorm
(
gpa_study_hours
$
gpa
)
qqline
(
gpa_study_hours
$
gpa
)
Exercise 4: Use the
qqnorm
and
qqline
functions to
construct a normal probability plot of the study hour,
study_hours
, data.
(2 marks)
In [5]:
qqnorm
(
gpa_study_hours
$
study_hours
)
qqline
(
gpa_study_hours
$
study_hours
)
Exercise 5: Based upon the histograms and normal probability
plots, which of the variables, GPA (
gpa
) or study hours
(
study_hours
) appears to more closely follow a normal
distribution? You just need to state which variable.
(1 mark)
Answer: Based upon the histograms and the normal
probability plots, the variable "GPA" appears to more closely
follow normal distribution
Regardless of whether you think that the normal distribution is an appropriate model for
GPA or study hours, we will try modeling each using a normal distribution. So we will need to
define the mean and standard deviation in each case.
For the GPA data:
The GPA data has a mean of 3.59 and standard deviation of 0.29.
For the study hours data:
In [ ]:
mean
(
gpa_study_hours
$
gpa
)
sd
(
gpa_study_hours
$
gpa
)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
17.4766839378238
11.4089797139414
The study hour data has a mean of 17.5 hours and standard deviation of 11.4 hours.
In general, a GPA of at least 3.7 corresponds to a grade of at A- or better.
Exercise 5: Using a normal distribution model for GPA, what is
the probability that a student achieves a grade of A- or better,
which is a GPA of 3.7 or higher
(2 marks)
0.654959226677094
Answer: The probability is 65.5 percent
A common rule of thumb suggests that for every one hour spent in class,
students should spend approximately two hours outside of class studying
for that course. That would meean approximately 30 hours of study for a
student taking five courses.
Exercise 6: Using a normal distribution model for study hours,
what is the probability that a student is spending at least 30
hours studying?
(2 marks)
0.863826100654788
Answer: The probability is 86.4 percent
Modeling time required for an oil change
The time required by Speedy Lube to complete an oil change service on an
automobile follows approximately a normal distribution with a mean of 17
minutes and a standard deviation of 2.5 minutes.
In [13]:
mean
(
gpa_study_hours
$
study_hours
)
sd
(
gpa_study_hours
$
study_hours
)
In [6]:
pnorm
(
q
=
3.7
,
mean
(
gpa_study_hours
$
gpa
),
sd
(
gpa_study_hours
$
gpa
))
In [7]:
pnorm
(
q
=
30
,
mean
(
gpa_study_hours
$
study_hours
),
sd
(
gpa_study_hours
$
study_hours
))
Let X represent the time required to complete an oil change service.
Then $X~N(\mu = 17, \sigma = 2.5)$
Exercise 7: Speedy Lube guarantees that the service will take
no longer than 20 minutes. If it does take longer, the customer
will receive the service for half price. What proportion of
customers receive the service for half price?
(2 marks)
1.2
Answer:
Exercise 8: If Speedy Lube does not want to give the discount
to more than 3% of its customers, how long should it make
the guaranteed time limit?
(2 marks)
21.7025
Answer:
In [8]:
(
20-17
)
/
2.5
In [9]:
(
1.881
*
2.5
)
+
17