0% found this document useful (0 votes)
2 views11 pages

Practical10 R

The document explores various continuous probability distributions including Poisson, Normal, Standard Normal, and Chi-Square distributions. It provides problem statements, theoretical explanations, formulas, step-by-step calculations, R scripts, and results for each distribution. Each section details the probabilities associated with specific scenarios, illustrating the use of statistical methods in practical applications.

Uploaded by

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

Practical10 R

The document explores various continuous probability distributions including Poisson, Normal, Standard Normal, and Chi-Square distributions. It provides problem statements, theoretical explanations, formulas, step-by-step calculations, R scripts, and results for each distribution. Each section details the probabilities associated with specific scenarios, illustrating the use of statistical methods in practical applications.

Uploaded by

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

PRACTICAL NO.

10
Exploring Continuous Probability Distributions
Poisson | Normal | Standard Normal | Chi-Square | t-Distribution

Q1. Poisson Distribution [λ = 5]

▶ Given / Problem Statement


Number of road accidents on a highway during a month follows a Poisson distribution with mean λ = 5.
Find the probability that in a certain month the number of accidents will be:
• a) Less than 3 → P(X < 3)
• b) Between 3 and 5 → P(3 ≤ X ≤ 5)
• c) More than 3 → P(X > 3)

▶ Theory — Poisson Distribution


The Poisson distribution models the number of events occurring in a fixed interval of time or space when events
happen independently at a constant average rate λ.
• Used for: counting rare/discrete events — accidents, defects, calls per hour
• Parameter: λ (lambda) = mean number of events
• Range: X = 0, 1, 2, 3, ... (non-negative integers only)
• Mean = Variance = λ

▶ Formula
P(X = k) = (e^(-λ) × λ^k) / k!
Where: λ = mean = 5, k = number of occurrences, e ≈ 2.71828
In R: ppois(k, lambda) → gives P(X ≤ k) [cumulative]

▶ Step-by-Step Theoretical Calculation


P (X = 0) = e^(-5) × 5^0 / 0! = 0.006738
P (X = 1) = e^(-5) × 5^1 / 1! = 0.033690
P (X = 2) = e^(-5) × 5^2 / 2! = 0.084224

a) P(X < 3) = P(X=0) + P(X=1) + P(X=2) = ppois(2, 5)


b) P (3 ≤ X ≤ 5) = P(X≤5) - P(X≤2) = ppois(5,5) - ppois(2,5)
c) P (X > 3) = 1 - P(X ≤ 3) = 1 - ppois (3, 5)

▶ R Script
# Question 1: Poisson Distribution with lambda = 5
lambda <- 5
# a) P(X < 3) = P(X <= 2)
p_a <- ppois(2, lambda = lambda)
cat('a) P(X < 3) =', p_a, '\n')

# b) P(3 <= X <= 5) = P(X <= 5) - P(X <= 2)


p_b <- ppois(5, lambda) - ppois(2, lambda)
cat('b) P(3 <= X <= 5) =', p_b, '\n')

# c) P(X > 3) = 1 - P(X <= 3)


p_c <- 1 - ppois(3, lambda = lambda)
cat('c) P(X > 3) =', p_c, '\n')

▶ Code Explanation (Line by Line)


lambda <- 5 → Stores the Poisson parameter (mean) λ = 5
ppois(2, lambda=lambda) → Cumulative probability P(X ≤ 2); since X<3 means X≤2
ppois(5, lambda) - ppois(2, lambda) → P(X≤5) minus P(X≤2) gives P(3 ≤ X ≤ 5)
1 - ppois(3, lambda) → P(X > 3) = 1 - P(X ≤ 3) [complement rule]
cat(...) → Prints the label and result to the R console

▶ Results

a) P(X < 3) = ppois(2, 5) ≈ 0.1247 (12.47%)


b) P(3 ≤ X ≤ 5) = ppois(5,5) - ppois(2,5) ≈ 0.4405 (44.05%)
c) P(X > 3) = 1 - ppois(3, 5) ≈ 0.7350 (73.50%)

Interpretation:
• There is ~12.47% chance that fewer than 3 accidents occur in the month.
• There is ~44.05% chance of exactly 3, 4, or 5 accidents.
• There is ~73.50% chance that more than 3 accidents occur.
Q2. Normal Distribution X ~ N(50, 49)

▶ Given / Problem Statement


X follows a Normal distribution with mean μ = 50 and variance σ² = 49 ⟹ σ = 7
Note: N(μ, σ²) notation: μ = 50, σ² = 49, so σ = √49 = 7
• a) P(X ≤ 60)
• b) P(10 ≤ X ≤ 60)
• c) P(X ≥ 60)

▶ Theory — Normal Distribution


The Normal (Gaussian) distribution is a continuous bell-shaped distribution completely defined by its mean μ and
standard deviation σ.
• Symmetric about the mean
• Mean = Median = Mode = μ
• Total area under curve = 1
• 68-95-99.7 rule applies

▶ Formula
f(x) = (1 / σ√2π) × exp[ -(x-μ)² / 2σ² ]
Z-score conversion: Z = (X - μ) / σ = (X - 50) / 7
In R: pnorm(x, mean = μ, sd = σ) → P(X ≤ x)

▶ Step-by-Step Z-Score Calculation


μ = 50, σ = 7

a) P(X ≤ 60): Z = (60 - 50) / 7 = 10/7 ≈ 1.4286


P(X ≤ 60) = P(Z ≤ 1.4286) = pnorm(60, 50, 7)

b) P(10 ≤ X ≤ 60):
Z1 = (10 - 50)/7 = -40/7 ≈ -5.7143 (extremely far left)
Z2 = (60 - 50)/7 = 10/7 ≈ 1.4286
P(10 ≤ X ≤ 60) = pnorm(60,50,7) - pnorm(10,50,7)

c) P(X ≥ 60) = 1 - P(X ≤ 60) = 1 - pnorm(60, 50, 7)

▶ R Script
# Question 2: Normal Distribution X ~ N(50, 49)
mu <- 50 # mean
sigma <- 7 # standard deviation = sqrt(49)
# a) P(X <= 60)
p_a <- pnorm(60, mean = mu, sd = sigma)
cat('a) P(X <= 60) =', p_a, '\n')

# b) P(10 <= X <= 60)


p_b <- pnorm(60, mean = mu, sd = sigma) - pnorm(10, mean = mu, sd = sigma)
cat('b) P(10 <= X <= 60) =', p_b, '\n')

# c) P(X >= 60) = 1 - P(X <= 60)


p_c <- 1 - pnorm(60, mean = mu, sd = sigma)
cat('c) P(X >= 60) =', p_c, '\n')

# Alternative for (c) using [Link] = FALSE


p_c_alt <- pnorm(60, mean = mu, sd = sigma, [Link] = FALSE)
cat('c) P(X >= 60) [alt] =', p_c_alt, '\n')

▶ Code Explanation (Line by Line)


sigma <- 7 → σ = √variance = √49 = 7
pnorm(60, mean=mu, sd=sigma) → Cumulative probability P(X ≤ 60) for N(50,7)
pnorm(60,...) - pnorm(10,...) → Subtracting lower bound probability gives P(10 ≤ X ≤ 60)
1 - pnorm(60,...) → Complement: P(X ≥ 60) = 1 - P(X < 60)
[Link] = FALSE → Tells R to compute upper tail directly; gives same result

▶ Results

a) P(X ≤ 60) = pnorm(60, 50, 7) ≈ 0.9236 (92.36%)


b) P(10 ≤ X ≤ 60) = pnorm(60,50,7) - pnorm(10,50,7) ≈ 0.9236 (92.36%)
c) P(X ≥ 60) = 1 - pnorm(60, 50, 7) ≈ 0.0764 ( 7.64%)

Note for b): pnorm(10, 50, 7) ≈ 0.0000 because Z = (10-50)/7 ≈ -5.71, which is essentially 0.
• P(X ≥ 60) and P(X ≤ 60) always sum to 1 → 0.9236 + 0.0764 = 1.0000 ✓
Q3. Standard Normal Distribution X ~ N(0, 1)

▶ Given / Problem Statement


X follows a Standard Normal distribution: μ = 0, σ = 1 → X ~ N(0, 1)
• a) P(X ≤ 2)
• b) P(0.84 ≤ X ≤ 2.5)
• c) P(X ≥ 0.84)

▶ Theory — Standard Normal Distribution


The Standard Normal is a special normal distribution with mean = 0 and standard deviation = 1. All Z-scores follow
this distribution.
• No conversion needed — the values are already Z-scores
• Symmetric about Z = 0
• P(Z ≤ 0) = 0.5 (exactly half the distribution is below 0)
• In R: pnorm(z) with no mean/sd defaults to μ=0, σ=1

▶ Formula
φ(z) = (1/√2π) × e^(-z²/2)
P(X ≤ z) = pnorm(z) [uses μ=0, σ=1 by default in R]
P(a ≤ X ≤ b) = pnorm(b) - pnorm(a)
P(X ≥ z) = 1 - pnorm(z) [or pnorm(z, [Link]=FALSE)]

▶ Step-by-Step Calculation
a) P(X ≤ 2.0) → Area to the left of Z = 2.0
b) P(0.84 ≤ X ≤ 2.5) = P(Z ≤ 2.5) - P(Z ≤ 0.84)
c) P(X ≥ 0.84) = 1 - P(Z ≤ 0.84)

▶ R Script
# Question 3: Standard Normal Distribution X ~ N(0, 1)
# Note: pnorm() defaults to mean=0, sd=1 when no arguments given

# a) P(X <= 2)
p_a <- pnorm(2)
cat('a) P(X <= 2) =', p_a, '\n')

# b) P(0.84 <= X <= 2.5)


p_b <- pnorm(2.5) - pnorm(0.84)
cat('b) P(0.84 <= X <= 2.5) =', p_b, '\n')
# c) P(X >= 0.84)
p_c <- 1 - pnorm(0.84)
cat('c) P(X >= 0.84) =', p_c, '\n')

# Verify: a) + c) complement check


cat('Verify b+c overlap: P(X>=0.84)+P(X<0.84) =', pnorm(0.84) + (1-
pnorm(0.84)), '\n')

▶ Code Explanation (Line by Line)


pnorm(2) → P(Z ≤ 2); R defaults to Standard Normal (μ=0, σ=1)
pnorm(2.5) - pnorm(0.84) → Area between Z=0.84 and Z=2.5; subtract lower from upper
1 - pnorm(0.84) → P(Z ≥ 0.84) = 1 - P(Z ≤ 0.84) [complement rule]

▶ Results

a) P(X ≤ 2.0) = pnorm(2) ≈ 0.9772 (97.72%)


b) P(0.84 ≤ X ≤ 2.5) = pnorm(2.5) - pnorm(0.84) ≈ 0.1957 (19.57%)
c) P(X ≥ 0.84) = 1 - pnorm(0.84) ≈ 0.2005 (20.05%)

• P(X ≤ 2) = 0.9772 is famous — it corresponds to about 2 standard deviations above mean.


• Notice: P(X ≥ 0.84) ≈ 0.2005 and P(X ≤ 0.84) ≈ 0.7995 sum to exactly 1 ✓
Q4. Chi-Square Distribution X ~ χ²(15)

▶ Given / Problem Statement


X follows a Chi-Square distribution with 15 degrees of freedom → X ~ χ²(15)
• a) P(X ≥ 24.996)
• b) P(7.261 ≤ X ≤ 24.996)

▶ Theory — Chi-Square Distribution


The Chi-Square (χ²) distribution is a continuous distribution used primarily in hypothesis testing and confidence
interval estimation for variance.
• Always non-negative (X ≥ 0)
• Positively skewed (right-skewed)
• Shape depends on degrees of freedom (df)
• Mean = df = 15, Variance = 2×df = 30
• As df → ∞, chi-square approaches normal distribution
• Used in: goodness-of-fit tests, independence tests, variance testing

▶ Formula
f(x; k) = x^(k/2-1) × e^(-x/2) / (2^(k/2) × Γ(k/2)), x ≥ 0
Where k = degrees of freedom, Γ = Gamma function
In R: pchisq(x, df) → P(X ≤ x) [lower tail, default]
1 - pchisq(x, df) → P(X ≥ x) [upper tail]

▶ Step-by-Step Calculation
df = 15

a) P(X ≥ 24.996) = 1 - P(X ≤ 24.996) = 1 - pchisq(24.996, 15)


Note: 24.996 ≈ χ²(0.05, 15) which is the critical value at 5% upper tail

b) P(7.261 ≤ X ≤ 24.996)
= P(X ≤ 24.996) - P(X ≤ 7.261)
= pchisq(24.996, 15) - pchisq(7.261, 15)
Note: 7.261 ≈ χ²(0.95, 15) critical value at 95% lower tail

▶ R Script
# Question 4: Chi-Square Distribution X ~ chi-sq(15)
df <- 15

# a) P(X >= 24.996) = 1 - P(X <= 24.996)


p_a <- 1 - pchisq(24.996, df = df)
cat('a) P(X >= 24.996) =', p_a, '\n')

# b) P(7.261 <= X <= 24.996)


p_b <- pchisq(24.996, df = df) - pchisq(7.261, df = df)
cat('b) P(7.261 <= X <= 24.996) =', p_b, '\n')

# Verify the critical values


cat('Critical value at 5% upper tail:', qchisq(0.95, df=df), '\n')
cat('Critical value at 5% lower tail:', qchisq(0.05, df=df), '\n')

▶ Code Explanation (Line by Line)


df <- 15 → Sets degrees of freedom to 15
1 - pchisq(24.996, df=df) → P(X ≥ 24.996) = 1 - cumulative probability up to 24.996
pchisq(24.996, df) - pchisq(7.261, df) → Area between 7.261 and 24.996
qchisq(0.95, df=df) → Gives the χ² value below which 95% of values fall (= 24.996)
qchisq(0.05, df=df) → Gives the χ² value below which 5% of values fall (= 7.261)

▶ Results

a) P(X ≥ 24.996) = 1 - pchisq(24.996, 15) ≈ 0.0500 (5.00%)


b) P(7.261 ≤ X ≤ 24.996) = pchisq(24.996,15) - pchisq(7.261,15) ≈ 0.9000 (90.00%)

Key Insight:
• 24.996 is the 95th percentile of χ²(15) → only 5% of values exceed this.
• 7.261 is the 5th percentile → only 5% of values are below this.
• So the central 90% of the distribution lies between 7.261 and 24.996.
Q5. t-Distribution X ~ t(6)

▶ Given / Problem Statement


X follows a t-distribution with 6 degrees of freedom → X ~ t(6)
• a) P(|X| ≥ 2.179) [two-tailed probability]
• b) P(X > 1.697) [one-tailed upper probability]

▶ Theory — Student's t-Distribution


The t-distribution (Student's t) is a symmetric, bell-shaped distribution used when sample size is small (n < 30) and
population standard deviation is unknown. It has heavier tails than the normal distribution.
• Symmetric about 0 (like standard normal)
• Heavier tails → more probability in extreme values
• Defined by degrees of freedom df = n - 1
• As df → ∞, t-distribution → Standard Normal
• Mean = 0, Variance = df/(df-2) for df > 2

▶ Formula
f(t; ν) = Γ((ν+1)/2) / [√(νπ) × Γ(ν/2)] × (1 + t²/ν)^(-(ν+1)/2)
Where ν = degrees of freedom
In R:
pt(t, df) → P(T ≤ t) [cumulative lower tail]
1 - pt(t, df) → P(T > t) [upper tail]
2 * (1 - pt(|t|, df)) → P(|T| ≥ |t|) [two-tailed]

▶ Step-by-Step Calculation
df = 6

a) P(|X| ≥ 2.179) → Two-tailed probability


By symmetry: P(|X| ≥ 2.179) = P(X ≤ -2.179) + P(X ≥ 2.179)
= 2 × P(X ≥ 2.179) [since t-distribution is symmetric]
= 2 × (1 - pt(2.179, df=6))

b) P(X > 1.697) → One-tailed upper probability


= 1 - pt(1.697, df = 6)
Note: 1.697 is the 95th percentile of t(6) → one-tailed 5% significance value

▶ R Script
# Question 5: t-Distribution X ~ t(6)
df <- 6
# a) P(|X| >= 2.179) = two-tailed probability
p_a <- 2 * (1 - pt(2.179, df = df))
cat('a) P(|X| >= 2.179) =', p_a, '\n')

# b) P(X > 1.697) = upper tail (one-tailed)


p_b <- 1 - pt(1.697, df = df)
cat('b) P(X > 1.697) =', p_b, '\n')

# Verify: check critical values


cat('Two-tailed critical value (alpha=0.05):', qt(0.975, df=df), '\n')
cat('One-tailed critical value (alpha=0.05):', qt(0.95, df=df), '\n')

▶ Code Explanation (Line by Line)


df <- 6 → Sets degrees of freedom = 6
pt(2.179, df=df) → P(T ≤ 2.179) = cumulative probability up to 2.179
1 - pt(2.179, df=df) → P(T > 2.179) = upper tail probability (right side only)
2 * (1 - pt(2.179, df=df)) → P(|T| ≥ 2.179) = both tails combined (two-tailed test)
The factor of 2 uses symmetry: left tail = right tail for t-distribution
1 - pt(1.697, df=df) → P(T > 1.697) = one-tailed upper tail
qt(0.975, df=df) → Inverse of pt(); finds t* where P(T ≤ t*)=0.975
This gives ±2.179 as two-tailed 5% critical values for t(6)

▶ Results

a) P(|X| ≥ 2.179) = 2 × (1 - pt(2.179, 6)) ≈ 0.0500 (5.00%)


b) P(X > 1.697) = 1 - pt(1.697, 6) ≈ 0.0500 (5.00%)

Key Insight:
• 2.179 is the two-tailed critical value for t(6) at α = 0.05.
• 1.697 is the one-tailed critical value for t(6) at α = 0.05.
• Both give exactly 5% probability in the tail(s), confirming these are standard significance test boundaries.
• In hypothesis testing: if computed t exceeds 2.179 (two-tailed) or 1.697 (one-tailed), reject H₀ at 5%.
COMPLETE ANSWER SUMMARY

Q Distribution Sub-part Answer


1 Poisson (λ=5) a) P(X < 3) ppois(2, 5) ≈
0.1247
b) P(3 ≤ X ≤ 5) ppois(5,5) - ppois(2,5) ≈
0.4405
c) P(X > 3) 1 - ppois(3, 5) ≈
0.7350
2 Normal N(50,49) a) P(X ≤ 60) pnorm(60, 50, 7) ≈
0.9236
b) P(10 ≤ X ≤ 60) pnorm(60,50,7)-pnorm(10,50,7) ≈
0.9236
c) P(X ≥ 60) 1 - pnorm(60, 50, 7) ≈
0.0764
3 N(0,1) Std Nrml a) P(X ≤ 2) pnorm(2) ≈
0.9772
b) P(0.84 ≤ X ≤ 2.5) pnorm(2.5) - pnorm(0.84) ≈
0.1957
c) P(X ≥ 0.84) 1 - pnorm(0.84) ≈
0.2005
4 Chi-Sq χ²(15) a) P(X ≥ 24.996) 1 - pchisq(24.996, 15) ≈
0.0500
b) P(7.261 ≤ X ≤ pchisq(24.996,15)-
24.996) pchisq(7.261,15) ≈ 0.9000
5 t-dist t(6) a) P(|X| ≥ 2.179) 2*(1 - pt(2.179, 6)) ≈
0.0500
b) P(X > 1.697) 1 - pt(1.697, 6) ≈
0.0500

Quick R Function Reference:

Poisson Normal Chi-Square t-Distribution


dpois, ppois dnorm, pnorm dchisq, pchisq dt, pt
qpois, rpois qnorm, rnorm qchisq, rchisq qt, rt

You might also like