Normal Probability Distribution Using R

 

Experiment

Normal Probability Distribution Using R

1. Aim

To study and implement the Normal probability distribution in R by calculating probabilities, standard scores, generating probability values, and visualizing the normal distribution.


2. Objectives

After completing this experiment, students should be able to:

  1. Understand the concept and characteristics of the Normal distribution.
  2. Identify the parameters of a Normal distribution.
  3. Calculate probabilities using the Normal distribution formula.
  4. Calculate the standard score (zz-score).
  5. Calculate probabilities using R.
  6. Find probabilities below, above, and between specified values.
  7. Generate values from a Normal distribution.
  8. Visualize the Normal distribution using R.
  9. Interpret the results obtained from a Normal distribution.

3. Theory

3.1 Normal Distribution

The Normal distribution is a continuous probability distribution that is widely used to model naturally occurring measurements such as:

  • Heights
  • Weights
  • Measurement errors
  • Examination scores
  • Manufacturing measurements
  • Blood pressure
  • Test scores

The probability density function of a Normal distribution is:

z=x−μσz = \frac{x - \mu}{\sigma}
z=(4)−(1.5)1.8=1.389z=\frac{(\text{4})-(\text{1.5})}{\text{1.8}}=\text{1.389}
Φ(z)≈91.8%\Phi(z)\approx \text{91.8\%}

x
x

μ\mu
σ\sigma
f(x)=1σ2πe−12(x−μσ)2f(x)=\frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2}

where:

  • μ\mu = population mean
  • σ\sigma = population standard deviation
  • xx = observed value

A Normal distribution is completely determined by its mean μ\mu and standard deviation σ\sigma.


3.2 Characteristics of Normal Distribution

A Normal distribution has the following important characteristics:

  1. It is continuous.
  2. It is bell-shaped.
  3. It is symmetric about the mean.
  4. Mean, median, and mode are equal.
  5. The total area under the curve is 1.
  6. The curve extends theoretically from −∞-\infty to +∞+\infty.
  7. The standard deviation determines the spread of the distribution.

4. Problem Statement

The marks obtained by students in a particular examination are approximately normally distributed with:

μ=70\mu=70

and

σ=10\sigma=10

Let XX represent the examination mark of a randomly selected student.

Therefore:

X∼N(70,102)X\sim N(70,10^2)

Using the Normal distribution:

  1. Calculate the zz-score for a student who scored 80 marks.
  2. Find the probability that a randomly selected student scores less than 80.
  3. Find the probability that a student scores more than 80.
  4. Find the probability that a student scores between 60 and 80.
  5. Find the probability that a student scores between 70 and 90.
  6. Generate a set of random examination marks from the Normal distribution.
  7. Plot the Normal probability density curve.
  8. Interpret the results.

5. Manual Calculation

5.1 Calculation of the Z-score

The standard score or zz-score is calculated using:

z=x−μσz=\frac{x-\mu}{\sigma}

For x=80x=80:

z=80−7010z=\frac{80-70}{10} z=1\boxed{z=1}

Therefore, a score of 80 is one standard deviation above the mean.


5.2 Probability of Scoring Less Than 80

We need to find:

P(X<80)P(X<80)

First convert 80 into a zz-score:

z=80−7010=1z=\frac{80-70}{10}=1

Therefore:

P(X<80)=P(Z<1)P(X<80)=P(Z<1)

From the standard Normal distribution table:

P(Z<1)≈0.8413P(Z<1)\approx0.8413

Therefore:

P(X<80)≈0.8413\boxed{P(X<80)\approx0.8413}

or approximately 84.13%.


5.3 Probability of Scoring More Than 80

We need:

P(X>80)P(X>80)

Using the complement:

P(X>80)=1−P(X≤80)P(X>80)=1-P(X\leq80)

Therefore:

P(X>80)=1−0.8413P(X>80)=1-0.8413 P(X>80)≈0.1587\boxed{P(X>80)\approx0.1587}

or approximately 15.87%.


5.4 Probability of Scoring Between 60 and 80

We need:

P(60<X<80)P(60<X<80)

Calculate the two zz-scores.

For X=60X=60:

z1=60−7010=−1z_1=\frac{60-70}{10}=-1

For X=80X=80:

z2=80−7010=1z_2=\frac{80-70}{10}=1

Therefore:

P(60<X<80)=P(−1<Z<1)P(60<X<80)=P(-1<Z<1)

From the standard Normal distribution:

P(Z<1)=0.8413P(Z<1)=0.8413

and

P(Z<−1)=0.1587P(Z<-1)=0.1587

Therefore:

P(−1<Z<1)=0.8413−0.1587P(-1<Z<1)=0.8413-0.1587 P(60<X<80)=0.6826\boxed{P(60<X<80)=0.6826}

or approximately 68.26%.

This illustrates the well-known 68% rule: approximately 68% of observations in a Normal distribution lie within one standard deviation of the mean.


5.5 Probability of Scoring Between 70 and 90

We need:

P(70<X<90)P(70<X<90)

For 70:

z1=70−7010=0z_1=\frac{70-70}{10}=0

For 90:

z2=90−7010=2z_2=\frac{90-70}{10}=2

Therefore:

P(70<X<90)=P(0<Z<2)P(70<X<90)=P(0<Z<2)

Using the standard Normal distribution:

P(Z<2)≈0.9772P(Z<2)\approx0.9772

and

P(Z<0)=0.5P(Z<0)=0.5

Therefore:

P(0<Z<2)=0.9772−0.5P(0<Z<2)=0.9772-0.5 P(70<X<90)≈0.4772\boxed{P(70<X<90)\approx0.4772}

or approximately 47.72%.


6. R Functions for Normal Distribution

R provides the following important functions:

R FunctionPurpose
dnorm()        Probability density at a specified value
pnorm()        Cumulative probability
qnorm()        Quantile corresponding to a probability
rnorm()        Generates random observations

For a Normal distribution with mean 70 and standard deviation 10:

dnorm(x, mean = 70, sd = 10)

calculates the density at xx.

pnorm(x, mean = 70, sd = 10)

calculates:

P(X≤x)P(X\leq x)
qnorm(p, mean = 70, sd = 10)

finds the value xx corresponding to a specified cumulative probability.

rnorm(n, mean = 70, sd = 10)

generates n random observations from the Normal distribution.


7. Program

# Normal Probability Distribution

# Parameters
mu <- 70
sigma <- 10


# 1. Calculate Z-score for X = 80

x <- 80

z <- (x - mu) / sigma

cat("Z-score for X = 80 =", z, "\n")


# 2. Probability of scoring less than 80

p_less_80 <- pnorm(80,
                   mean = mu,
                   sd = sigma)

cat("P(X < 80) =", p_less_80, "\n")


# 3. Probability of scoring more than 80

p_more_80 <- 1 - pnorm(80,
                        mean = mu,
                        sd = sigma)

cat("P(X > 80) =", p_more_80, "\n")


# 4. Probability of scoring between 60 and 80

p_60_80 <- pnorm(80,
                 mean = mu,
                 sd = sigma) -
           pnorm(60,
                 mean = mu,
                 sd = sigma)

cat("P(60 < X < 80) =", p_60_80, "\n")


# 5. Probability of scoring between 70 and 90

p_70_90 <- pnorm(90,
                 mean = mu,
                 sd = sigma) -
           pnorm(70,
                 mean = mu,
                 sd = sigma)

cat("P(70 < X < 90) =", p_70_90, "\n")


# 6. Generate random examination marks

set.seed(123)

marks <- rnorm(100,
               mean = mu,
               sd = sigma)

cat("\nFirst 10 generated marks:\n")
print(marks[1:10])


# 7. Plot the Normal distribution

x_values <- seq(30, 110, by = 0.5)

y_values <- dnorm(x_values,
                  mean = mu,
                  sd = sigma)

plot(x_values,
     y_values,
     type = "l",
     main = "Normal Probability Distribution",
     xlab = "Examination Marks",
     ylab = "Probability Density")

8. Expected Result

The program produces approximately the following results:

Z-score for X = 80 = 1

P(X < 80) = 0.8413447

P(X > 80) = 0.1586553

P(60 < X < 80) = 0.6826895

P(70 < X < 90) = 0.4772499

The program also generates 100 random examination marks following:

N(70,102)N(70,10^2)

and displays the Normal distribution as a bell-shaped curve.




9. Interpretation

From the results:

  • A score of 80 has a zz-score of 1, meaning it is one standard deviation above the mean.
  • Approximately 84.13% of students are expected to score below 80.
  • Approximately 15.87% are expected to score above 80.
  • Approximately 68.27% are expected to score between 60 and 80.
  • Approximately 47.72% are expected to score between 70 and 90.

The graph should show the characteristic symmetric bell-shaped curve of the Normal distribution, centered at the mean of 70.


10. Result

Thus, the Normal probability distribution was studied and implemented using R. The z-score and probabilities for different ranges of examination marks were calculated manually using the standard Normal distribution concept and verified using R functions. Random observations were generated from the Normal distribution, and the corresponding probability density curve was plotted and interpreted.

Comments

Popular posts from this blog

Statistical Methods Lab ( R Language) PCCBL308 Semester 3 KTU BTech CB and CU 2024 Scheme - Dr Binu V P

Programs in R - using control statements - Assignment 2

Programs to try using Functions in R - Assignment 3