0% found this document useful (0 votes)
7 views3 pages

Tutorial 4

Uploaded by

sidhiyash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

Tutorial 4

Uploaded by

sidhiyash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Indian Institute of Technology Ropar

Department of Mathematics
MA630: Introduction to Applied Statistical Methods
1st Semester of Academic Year 2025-26
Tutorial Sheet 4

Note: Bring your laptops for the tutorial session fully charged having Jamovi and R installed.
1. Suppose you’re deciding where to order coffee, and waiting time is a concern. You’re considering Brew Haven, where
the average waiting time is 12 minutes with a standard deviation of 2 minutes. Or you might go to Java Express, where
the average waiting time is 9 minutes with a standard deviation of 3 minutes. Assume waiting times at both coffee shops
are normally distributed.
(a) Find the 𝑍-score for a waiting time of 14 minutes at Brew Haven.
(b) Find the 𝑍-score for a waiting time of 7 minutes at Java Express.
(c) Which wait time is more likely: 11 minutes at Brew Haven or 6 minutes at Java Express?
(d) About 95 % of wait times at Brew Haven are approximately between ........... and ........... .
(e) About 99.7 % of wait times at Java Express are approximately between ........... and ........... .
(f) How long would you have to wait at Java Express to be in the same percentile as a 13-minute wait at Brew Haven?
2. In a standardized exam worth 170 points, a student’s score corresponds to the 75.5th percentile of all scores.
(a) Based on this information, what percentage of exam takers had scores equal to or better than the student’s score?
(b) For admission to a special program, only students who score in the top 2.5 % are considered. Assuming the exam
scores are normally distributed with mean 𝜇 = 55 and standard deviation 𝜎 = 4, what is the minimum score
required for eligibility?
3. The National Coding Aptitude Test consists of several sections. On one section, the scores are normally distributed
with a mean of 72 and a standard deviation of 8. Answer the following:
(a) What score corresponds to the 70th percentile (i.e., separates the lowest 70 % from the highest 30 % of the distri-
bution)?
(b) What score corresponds to the 95th percentile?
(c) What is the probability that a randomly selected student scores between 65 and 80?
For 𝑍 ∼ 𝑁(0, 1), some useful values are provided below:
𝑃 (𝑍 ≤ 0,524) = 0,70, 𝑃 (𝑍 ≤ 1,645) = 0,95, 𝑃 (0 < 𝑍 < 1) = 0,3413, 𝑃 (𝑍 < −0,875) = 0,1908
4. Let 𝑋 ∼ 𝑁(𝜇, 𝜎 2 ). Use R to plot the probability density curve of this distribution over the interval 𝑥 ∈ (𝜇 − 4𝜎, 𝜇 + 4𝜎)
for the following parameter sets:
(a) 𝜇 = 5, 𝜎 2 = 1
(b) 𝜇 = −3, 𝜎 2 = 2,25
(c) 𝜇 = 10, 𝜎 2 = 16
For each graph, draw a vertical line at 𝑥 = 𝜇 to mark the mean.
Next, check the **68–95–99.7 rule** for these cases by computing in R the probabilities:
(a) 𝑃 (𝜇 − 𝜎 < 𝑋 < 𝜇 + 𝜎)
(b) 𝑃 (𝜇 − 2𝜎 < 𝑋 < 𝜇 + 2𝜎)
(c) 𝑃 (𝜇 − 3𝜎 < 𝑋 < 𝜇 + 3𝜎)
5. Use the Inverse Transformation Method in R to generate random samples from the Exponential distribution with
mean 𝜆.
(A) For the following cases, generate samples and compute their sample mean and variance. Also, draw histograms
with density curves and add vertical lines for 𝜆 and the sample mean. Summarize your observations.
(a) 𝑛 = 15, 𝜆 = 2
(b) 𝑛 = 50, 𝜆 = 2
(c) 𝑛 = 105 , 𝜆 = 2
(d) 𝑛 = 105 , 𝜆 = 3
(B) Repeat the simulation multiple times and comment on the stability of your results as 𝑛 increases.
(C) Generate two independent samples of size 𝑛 from Exp(𝜆 = 2), call them X and Y, and define Z = X − Y.
a) Find the sample mean and variance of Z.
b) Plot the histogram and density of Z, with vertical lines at 0 and the sample mean.
c) Write down your observations.
6. A random variable 𝑋 is said to have a continuous uniform distribution over (𝑎, 𝑏) if its probability density function is

⎧ 1
⎪𝑏 − 𝑎, 𝑎 < 𝑥 < 𝑏,
𝑓 (𝑥) = ⎨

⎩0, otherwise.

Find the cdf of 𝑋.

Given 6 values from 𝑈 (0, 1): 0.0831, 0.3174, 0.9422, 0.7310, 0.5628, 0.2045.

Use the Inverse Transformation Method to generate 𝑛 random numbers from 𝑈 (𝑎, 𝑏) using the above 𝑈 (0, 1) values.
Carry out this simulation manually for the following (𝑎, 𝑏):
(a) 𝑎 = 1, 𝑏 = 3
(b) 𝑎 = −2, 𝑏 = 0,5
Compute the sample mean in each case and briefly state your observation.

7. Consider the following continuous probability distribution with parameters 𝜃 ∈ ℝ and 𝜆 > 0, whose cumulative
distribution function (cdf) is given by
1
𝐹 (𝑥) = , 𝑥 ∈ ℝ.
𝑥−𝜃
1 + exp( − 𝜆 )

This is known as the logistic distribution. Using the inverse transformation method, generate 5 × 104 random numbers
from this distribution in R for the following choices of (𝜃, 𝜆):
(a) 𝜃 = 0, 𝜆 = 1
(b) 𝜃 = 3, 𝜆 = 1
(c) 𝜃 = 5, 𝜆 = 2
(d) 𝜃 = 7, 𝜆 = 3
(e) 𝜃 = −2, 𝜆 = 2
(f) 𝜃 = 4, 𝜆 = 0,5

For each case:


1. Compute the statistics such as sample mean, median, and variance.
2. Plot both the histogram and the estimated density curve on the same graph.
3. Add vertical lines corresponding to the parameter 𝜃 and the sample mean.

Run the simulation code more than once. Do you always get the same statistics and plots? Write down your observations
regarding the stability of the results and the role of random sampling in such simulations.
8. A random variable 𝑋 is said to have a Gamma distribution [Gamma(𝛼, 𝛽)], if its pdf is of the form:
𝛽 𝛼 𝛼−1 −𝛽𝑥
Γ(𝛼)
𝑥 𝑒 if 𝑥 > 0, 𝛼 > 0, 𝛽 > 0
𝑓 (𝑥) =
{0, otherwise

Its cdf is not in closed form and hence not invertible. However, we know the following result:
Let 𝑌1 , 𝑌2 , ..., 𝑌𝛼 be a random sample of size 𝛼 from Exponential distribution with rate 𝛽 having the following cdf:

0 if 𝑦 < 0
𝐹 (𝑦) =
{1 − 𝑒−𝛽𝑦 , if 𝑦 ≥ 0, 𝛽 > 0

Page 2
Then 𝛼

∑ 𝑌𝑖 ∼ Gamma(𝛼, 𝛽)
𝑖=1

Use the above result and Inverse Transformation Method to generate a random sample of size 𝑛 = 105 from the
distributions Gamma(𝛼 = 7, 𝛽 = 4) and Gamma(𝛼 = 12, 𝛽 = 1) in R. Find the mean and variance of the sample. Also
draw the density plot and histogram and add vertical lines through 𝛼𝛽 and sample mean. What is your observation? Try
to run the code by changing the values of 𝑛, 𝛼, 𝛽. Write down your observation precisely.
9. Write an R function that returns 𝑛 independent samples from the 𝒩 (0, 1) distribution using the Box–Muller method.
Use your function to generate 10, 000 samples, and verify that the empirical mean and variance are close to the true
values.

10. Compare the Box–Muller method with R’s built-in rnorm function.
(a) Generate 5000 samples from 𝒩 (0, 1) using Box–Muller method.
(b) Generate another 5000 samples using rnorm.
(c) Compare the mean and variance for part (a) and (b).
11. Write an R function that generates 𝑛 pairs (𝑍1 , 𝑍2 ) using the Box–Muller method. Simulate 5000 pairs and:
(a) Create a scatterplot of (𝑍1 , 𝑍2 ).
(b) Estimate the correlation coefficient and verify that it is close to zero.
12. Extend the simulation to generate a non-independent bivariate normal distribution with correlation 𝜌 = 0,5. Consider
the linear transformation:
𝑋 = 𝑍1 , 𝑌 = 𝜌𝑍1 + √1 − 𝜌2 𝑍2 .
(a) Generate a surface (density) plot of the joint distribution.
(b) Plot the scatterplot of the simulated (𝑋, 𝑌 ) pairs.
(c) Calculate the sample correlation between 𝑋 and 𝑌.
13. Load the data FIFA_data.csv in jamovi. This data set contains information on 17,588 FIFA soccer players.
(a) The maximum Rating for any player is ........... points.
(b) The range of Weight (kg) among players is ........... kg.
(c) Half of players have a Short_Pass score above ............ .
(d) The average Long_Shots score is about ........... .
(e) About 25 percent of players have a Heading ability below ........... .
(f) The 90th percentile for Penalties is ........... .
(g) The tallest player is about ........... cm taller than the shortest player.
(h) Plot the histogram of Age and comment upon its skewness.

Best Wishes

Page 3

You might also like