STM4PSD Assignment 1: Statistical Analysis and Probability Problems

Verified

Added on  2022/12/23

|7
|976
|100
Homework Assignment
AI Summary
This document presents a comprehensive solution to STM4PSD Assignment 1, focusing on probability and statistical analysis. The assignment covers several key areas, including conditional probability calculations in a police checkpoint scenario, the analysis of association rules using support and confidence, and the implementation of R code for data analysis, specifically item frequency plots and rule generation. Further, the solution includes the derivation of expected values and variance from a given probability density function, and the calculation of probabilities from a joint probability table, which is followed by the calculation of marginal and conditional probabilities. The assignment demonstrates a strong understanding of statistical concepts and their application in various real-world scenarios, including the use of R programming for data analysis and problem-solving.
tabler-icon-diamond-filled.svg

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
Question 1
a)
P (Detained | Not drinking) = 0.2
b)
P (Detaining a driver) = (0.8*0.12) + (0.88*0.2)
= 0.272
c)
P (Detained | Been Drinking) = 0.80.12
0.272 = 0.353
d)
P (Detained | Been Drinking) = (0.80.12)
( 0.80.12 ) +(0.880.8) = 0.033
Question 2
a)
Support for SM = 5
6
Confidence for SM = 0.5
0.833 = 0.6
b)
Support for SM = 2
3 = 0.667
Confidence for SM = 3
4 = 0.75
c)
The rule 1 holds for both situations, therefore, the degree of association can be calculated by the
use of confidence
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
Question 3
a)
R code
#load the libraries
library(arules)
library(arulesViz)
library(datasets)
#load datasets
data(Groceries)
#create frequency plot for 8 items
itemFreqeuncyPlot(Groceries,topN=8,type=”absolute”)
b)
R code
#Get the rules
Rules<-apriori(Groceries,parameter=list(sup=0.05,conf=0.8))
#show top 8 rules
options(digits=2)
inspect(rules[1:8])
c)
root vegetables and Frankfurt are 82% correlated
Question 4
a)
F (t) = 1- 1
(1+t)α = α
(1+t)α +1
Document Page
b)
E(T )=
0

t α
(1+t )α +1 dt
Let z= (1+t)
Substituting z= (1+t) to the equation we get
E (T) =
1

( z1) α
zα +1 dz
E(T )=α
1

(zα z α1 )dz
E(T )=α (1
α 1
α+1 ) = 1
α 1
E(T ) Is measured in bytes
c)
E(T ¿¿ 2)¿=
1

t2 α
(1+t)α+1 dt
Let z= (1+t)
Substituting z= (1+t) into the equation gives;
Document Page
E(T ¿¿ 2)¿=
1

(z1)2 α
zα+1 dz
E(T ¿¿ 2)¿= α
1

( z ¿¿ 1α ¿2 zα+ zα1 )dz ¿ ¿
E(T ¿¿ 2)¿= α ( 1
2α + 2 1
1α + 1
α ) = 2
(2α )(1α ) = 2
(α 2)(α 1)
Var(T) = E(T ¿¿ 2) ¿-(E ( T ) )2= 2
(α 2)(α 1) - ( 1
α1 )
2
= 2
(α2)(α 1)
Question 5
a)
R code
f<-function(z){
(3/(gamma(2/3))*(x*x^(2/3)))
}
plot(f)
b)
f<-function(z){
(3/(gamma(2/3))*(x*x^(2/3)))
}
Int<-function(z){
Intergrate(f,lower=0,upper=inf,x=x)$value
}
c)
f<-function(z){
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
(x(3/(gamma(2/3))*(x*x^(2/3))))
}
Int<-function(z){
Intergrate(f,lower=0,upper=inf,x=x)$value
}
d)
f<-function(z){
(3/(gamma(2/3))*(x*x^(2/3)))
}
Int<-function(z){
Intergrate(f,lower=15,upper=inf,x=x)$value
}
e)
f<-function(z){
(3/(gamma(2/3))*(x*x^(2/3)))
}
Int<-function(z){
Intergrate(f,lower=0.05,upper=1.5,x=x)$value
}
Question 6
a)
P(X=2000 and Y=400) = 0.20 (from the joint probability table)
Document Page
P(X=2000 and Y=400) represents the joint probability of a computer price whose price is $2000
and a monitor price of $400.
b)
FX ,Y (2000, 400) = 0.2+0.3 =0.5
c)
P(x,y) y=400 y=800 Marginal probability
X=1600 0.3 0.25 0.3+0.25 = 0.55
X=2000 0.2 0.10 0.2+0.10 = 0.3
X=2400 0.1 0.05 0.1+0.05= 0.15
d)
The P(X+Y=2000) has two distinct results:
i) When X= 2000 and Y =400
P (T=2400) =P(X=2000, Y=400) + P(X=1600, Y=800) = 0.2+0.25 =0.45
t 2000 2400 2400 2800
f r t 0.3 0.45 0.2 0.05
e)
E (T) = (2000*0.3) + (2400*0.45) + (2800*0.2) + (3200*0.05) = 2400
f)
P (1600| 400) = P (1600 400)
P( 400)
But
P (400) = 0.3+0.2 +0.1 = 0.6
P(1600 400)= 0.30
Thus
Document Page
P (1600 | 400) = P (1600 400)
P(400) = 0.3
0.6 = 0.5
Therefore, the probability that a customer bought a $1600 computer given that she buys a $400
monitor is 0.5
chevron_up_icon
1 out of 7
circle_padding
hide_on_mobile
zoom_out_icon
logo.png

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]