Professional Documents
Culture Documents
Submitted By:: Probability and Probability Distribution
Submitted By:: Probability and Probability Distribution
Submitted By:
Md. Shahin Aktar
ID: 20228069
Session: Summer – 2022
Department of Statistics
Jahangirnagar University
Submitted To:
Dr. Tapati Basak
Associate Professor
Department of Statistics
Jahangirnagar University
In a study, patients who were involved in problem gambling treatment were asked about
co-occurring drug and alcohol addictions. Let, the discrete random variable X represent
the number of co-occurring addictive substances used by the subjects.
1 144
2 342
3 142
4 72
5 39
6 20
7 6
8 9
9 2
10 1
Total 777
i) Construct a table of the relative frequency and the cumulative frequency for this
Distribution.
ii) Construct a graph of the probability distribution and a graph representing the
cumulative probability distribution for these data.
iii) What is the probability that an individual selected at random used more than six
addictive substances?
Solution To Problem 1:
i) : Constructing relative frequency and the cumulative frequency table for the given
distribution:
Table 1: Relative frequency and the cumulative frequency Table of the given distribution
R Code:
install.packages("gridExtra")
library(gridExtra)
x<-1:10
f<-c(144,342,142,72,39,20,6,9,2,1)
y<-cumsum(f)
rf<-round(f/sum(f), digit=4)
data= data.frame(Number_of_Substances_Used=c(x),Frequency=c(f),
Relative_Freq=c(rf), Cumulative_Frequency=c(y))
data[nrow(data) + 1,] <- c("Total", sum(data$Frequency) ,
round(sum(data$Relative_Freq), digits = 3), "")
#Convert To PNG
png(filename = "table.png", height=600, width=1050, units = "px", res =
150)
grid.table(data, rows=NULL)
dev.off()
ii) Constructing a graph of the probability distribution chart:
R Codes:
x<-1:10
f<-c(144,342,142,72,39,20,6,9,2,1)
rf<-round(f/sum(f), digit=4)
#Convert To PNG
png(filename = "bargraph.png", height=600, width=1050, units = "px",
res = 150)
barplot(rf~x, xlab="Number of Substances Used",ylab="Probability
Density",col="brown", main="Probability Distribution Graph",ylim =
c(0, 0.5))
dev.off()
Graph representing the cumulative probability distribution for the given data:
R Code:
x<-1:10
f<-c(144,342,142,72,39,20,6,9,2,1)
cpd<-round(cumsum(f)/sum(f), digit=4)
Assume, the probability that an individual selected at random used more than six
addictive substances, P(x>6)
And, the probability that an individual selected at random used equal or less than six
addictive substances, P(X≤6),
R Code:
x<-1:10
f<-c(144,342,142,72,39,20,6,9,2,1)
px<-f/sum(f)
px_6 =1-sum(px[1:6])
print(px_6)
# Output:
0.02316
Problem 2:
For a study, acetone levels of a 29-year-old male were normally distributed with a mean
of
870 and a standard deviation of 211 ppb. Find the probability that on a given daythe
Subject’s acetone level is:
i) Between 600 and 1000 ppb; ii) Over 900 ppb; iii) Under 500 ppb
ii) Between 900 and 1100 ppb
Solution To Problem 2:
Here,
Mean = 870
Standard deviation = 211
𝑥−µ
Here, 𝑍 = is a standard normal variate
α
R Code:
p_600 = pnorm(600,mean = 870,sd=211,lower.tail = TRUE)
p_1000 = pnorm(1000,mean = 870,sd=211,lower.tail = TRUE)
# Output:
0.630751
P(X > 900) = P(𝒁 > (𝟗𝟎𝟎−𝟖𝟕𝟎)/ 𝟐𝟏𝟏 ) = P(Z > 0.14) =1-0.55567 = 0.44
R Code:
P(X < 500) = P(𝒁 < (𝟓𝟎𝟎−𝟖𝟕𝟎)/ 𝟐𝟏𝟏 ) = P(Z < - 1.75) = 0.04
R Code:
pnorm(500,mean=870,sd=211,lower.tail = TRUE)
# Output:
0.03975344
R Code:
# Output:
0.3056227