You are on page 1of 8

Assignment on

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

Date of Submission: 02/11/2022


Problem 1:

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.

Table 1 summarizes the frequency distribution for this random variable.

Table 1: Number of Co-occurring Addictive Substances Used by Patients in


Selected Gambling Treatment Programs

Number of Substances Used Frequency

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:

Figure 1: 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:

Figure 2: CumUlutive Probability Distribution Ogive Chart

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)

png(filename = "Cpdgraph.png", height=700, width=600, units = "px",


res = 130)
plot(x, cpd, xlab="Number of Substances Used",ylab="F(x)",type="s",
col = "dark red",main = "Cumulative Probability Distribution")
dev.off()
iii) : Probability that an individual selected at random used more than six addictive
substances:

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),

So, P(X>6) = 1- P(X≤6) = 1- 0.98 =0.02316 (Can be solved by Table or R Code)

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

i) Between 600ppb and 1000 ppb:

𝑥−µ
Here, 𝑍 = is a standard normal variate
α

So, P(600< X < 1000)


= P ((𝟔𝟎𝟎−𝟖𝟕𝟎)/ 𝟐𝟏𝟏 < 𝒁 < (𝟏𝟎𝟎𝟎−𝟖𝟕𝟎) /𝟐𝟏𝟏 )
= P( -1.28 < Z < 0.62 )
= P(Z < 0.62 ) – P(Z< -1.28)
= 0.73237 - 0.10027 = 0.6321

R Code:
p_600 = pnorm(600,mean = 870,sd=211,lower.tail = TRUE)
p_1000 = pnorm(1000,mean = 870,sd=211,lower.tail = TRUE)

result_1 = p_1000 - p_600


print(result_1)

# Output:
0.630751

ii): Over 900ppb:

P(X > 900) = P(𝒁 > (𝟗𝟎𝟎−𝟖𝟕𝟎)/ 𝟐𝟏𝟏 ) = P(Z > 0.14) =1-0.55567 = 0.44

R Code:

pnorm(900,mean = 870,sd=211,lower.tail = FALSE)


# Output:
0.4434689

ii): Under 500 ppb

P(X < 500) = P(𝒁 < (𝟓𝟎𝟎−𝟖𝟕𝟎)/ 𝟐𝟏𝟏 ) = P(Z < - 1.75) = 0.04
R Code:

pnorm(500,mean=870,sd=211,lower.tail = TRUE)

# Output:
0.03975344

ii) Between 900 and 1100 ppb

P(900< X < 1100)


= P ((9𝟎𝟎−𝟖𝟕𝟎)/ 𝟐𝟏𝟏 < 𝒁 < (𝟏1𝟎𝟎−𝟖𝟕𝟎) /𝟐𝟏𝟏 )
= P( 0.14 < Z < 1..09 )
= P(Z < 1.09 ) – P(Z< 0.14)
= 0.86214 - 0.55567
= 0.30647

R Code:

p_1100 = pnorm(1100,mean = 870,sd=211,lower.tail = TRUE)


p_900 = pnorm(900,mean = 870,sd=211,lower.tail = TRUE)

result_2 = p_1100 - p_900


print(result_2)

# Output:
0.3056227

You might also like