Professional Documents
Culture Documents
Loo Guan Yee A0223941J Assign2
Loo Guan Yee A0223941J Assign2
Loo Guan Yee A0223941J Assign2
2023-10-07
Q1
Q1a)
Σ11 AT
µ1 Σ11
where µ = and Σ = .
Aµ1 + b AΣ11 Ω + AΣ11 AT
Based on visual inspection,
2
µ1 =
1
1 0
Ω=
0 2
2X1 + 1 2 0 X1 1
= +
X1 − X2 1 −1 X2 0
2 0
A=
1 −1
1
b=
0
2 1
Σ11 =
1 2
T 2 1 2 1
Σ11 A =
1 2 0 −1
(2)(2) (2) − (1)
=
(1)(2) (1) + (2)(−1)
4 1
=
2 −1
2 0 2 1
AΣ11 =
1 −1 1 2
(2)(2) (2)(1)
=
(2) − (1) (1) − (2)
4 2
=
1 −1
1
1 0 2 0 2 1 2 1
Ω + AΣ11 AT = +
0 2 1 −1 1 2 0 −1
1 0 2 0 4 1
= +
0 2 1 −1 2 −1
1 0 (2)(4) (2)(1)
= +
0 2 (4)(1) + (−1)(2) (1)(1) + (−1)(−1)
1 0 8 2
= +
0 2 2 2
9 2
=
2 4
Σ11 AT
Σ11
We will compute the Σ =
AΣ11 Ω + AΣ11 AT
Σ11 AT
Σ11
Σ=
AΣ11 Ω + AΣ11 AT
2 1 4 1
2 −1
1 2
=
4 2 9 2
1 −1 2 4
2 1 4 1
1 2 2 −1
=4 2 9 2
1 −1 2 4
Therefore,
X1 2 2 1 4 1
X2 1 1 2 2 −1
Y1 ≈ N4 5 , 4
V =
2 9 2
Y2 1 1 −1 2 4
2
Q1b)
5 9 2
Y ∼N ,
1 2 4
3
Q1c)
W =X −Y
X1 − Y1
=
X2 − Y2
W = BV
X1
X2
=B
Y1
Y2
X1
1 0 −1 0 X2
=
0 1 0 −1 Y1
Y2
1 0 −1 0
B=
0 1 0 −1
Therefore,
−3 3 0
B∼N ,
0 0 8
4
Q2
Q2a)
1
1
1 to represent the state’s total energy consumption for these major sources.
Let a =
1
1
We will now find the variance of a state’s total energy consumption for these major sources.
5
Q2b)
1
−1
0 to represent the excess of petroleum consumption over natural gas consumption.
Let a =
0
0
We will now compute the variance of the excess of petroleum consumption over natural gas consumption.
6
Q3
Q3a)
n = 60
0.8
X̄ =
0.4
2 −1
S=
−1 2
1
µ0 =
0.5
## [1] 3.155932
Decision Boundary
(60−1)(2)
Reject H0 if test statistic > (60−2) F0.05 (2, 60 − 2) = 6.4207.
is less than the 6.4207, we do not reject the H0 . There is insufficient evidence at %5 significance level
Since the test statistic
1
to say that µ = .
0.5
7
Q3b)
n
S= Sn
n−1
n−1
Sn = S
n
59 2 −1
Sn =
60 −1 2
## [1] 7.814728
Decision Boundary
Reject H0 if −2logλ > χ2 0.95 (3) = 7.814728.
Conclusion
Since test statistics = 34.689 > 7.814728, we reject the H0 and conclude that at 5% significance level that there is significant
evidence against Σ = Σ0 .
8
Q4
library(mvtnorm)
mu1 <- c(3,1)
si1 <- matrix(c(4,2,2,9), ncol = 2)
set.seed(4250)
simunorm <- rmvnorm(100, mean = mu1, sigma = si1)
simunorm <- as.data.frame(simunorm)
head(simunorm, n = 5)
## V1 V2
## 1 2.362720 1.962778
## 2 2.621084 1.833044
## 3 7.883012 2.976779
## 4 1.278704 -3.664169
## 5 1.250515 -3.209010
apply(simunorm, 2, mean)
Q4a)
## V1 V2
## 2.9027170 0.9888259
var(simunorm)
## V1 V2
## V1 4.058433 1.293714
## V2 1.293714 9.390347
9
T 2 = n(x̄ − µ0 )T S −1 (x̄ − µ0 )
−1
2.9027170 3 T 4.058433 1.293714 2.9027170 3
= 100( − ) ( )( − )
0.9888259 1 1.293714 9.390374 0.9888259 1
T
−0.097283 1 9.390374 −1.293714 −0.097283
= 100
−0.0111741 (4.058433)(9.390374) − (1.293714)(1.293714) −1.293714 4.058433 −0.0111741
T
100 −0.097283 9.390374 −1.293714 −0.097283
=
36.43650781 −0.0111741 −1.293714 4.058433 −0.0111741
100 9.390374 −1.293714 −0.097283
= −0.097283 −0.0111741
36.43650781 −1.293714 4.058433 −0.0111741
100 (9.390374)(−0.097283) + (−1.293714)(−0.0111741)
= −0.097283 −0.0111741
36.43650781 (−1.293714)(−0.097283) + (4.058433)(−0.0111741)
100 −0.8990676642
= −0.097283 −0.0111741
36.43650781 0.08050704288
100
= (−0.097283 × −0.8990676642 + −0.0111741 × 0.08050704288)
36.43650781
100
= (0.08656440583)
36.43650781
= 0.2375760221
= 0.237576 (6 significant figures)
Q4b)
## [1] 3.089203
Decision Boundary:
Reject H0 if T 2 > 99(2)
98 F0.05 (2, 98) =
99(2)(3.089203)
98 = 6.2414509.
2 3
Since the T = 0.237576 < 6.2414509, we do not reject the null hypothesis. There is insufficient evidence to say that µ ̸= .
1
Q4c)
## [1] 3.089203
10
s s
T (n − 1)(p) T T (n − 1)(p)
a X̄ − F1−α (p, n − p)aT Sa ≤ a µ ≤ a X̄ + F1−α (p, n − p)aT Sa
n(n − p) n(n − p)
s
2.9027170 (100 − 1)(2) 1
1 0 − F1−0.05 (2, 100 − 2) 1 0 S ≤ µ1 and
0.9888259 100(100 − 2) 0
s
2.9027170 (100 − 1)(2) 1
1 0 + F1−0.05 (2, 100 − 2) 1 0 S ≥ µ1
0.9888259 100(100 − 2) 0
s
(99)(2) 4.058433 1.293714 1
2.9027170 − (3.089203) 1 0 ≤ µ1 and
100(98) 1.293714 9.390374 0
s
(99)(2) 4.058433 1.293714 1
2.9027170 + (3.089203) 1 0 ≥ µ1
100(98) 1.293714 9.390374 0
s s
(99)(2) 4.058433 (99)(2) 4.058433
2.9027170 − (3.089203) 1 0 ≤ µ1 ≤ 2.9027170 + (3.089203) 1 0
100(98) 1.293714 100(98) 1.293714
s s
(99)(2) (99)(2)
2.9027170 − (3.089203)(4.058433) ≤ µ1 ≤ 2.9027170 + (3.089203)(4.058433)
100(98) 100(98)
√ √
2.9027170 − 0.2533051054 ≤ µ1 ≤ 2.9027170 + 0.2533051054
2.3994227747 ≤ µ1 ≤ 3.406011253
2.3994 ≤ µ1 ≤ 3.4060 (5 significant figures)
For the µ2 computation, we will use a = 0 1 ,
s s
T (n − 1)(p) T T T (n − 1)(p)
a X̄ − F1−α (p, n − p)a Sa ≤ a µ ≤ a X̄ + F1−α (p, n − p)aT Sa
n(n − p) n(n − p)
s
2.9027170 (100 − 1)(2) 0
0 1 − F1−0.05 (2, 100 − 2) 0 1 S ≤ µ2 and
0.9888259 100(100 − 2) 1
s
2.9027170 (100 − 1)(2) 0
0 1 + F1−0.05 (2, 100 − 2) 0 1 S ≥ µ2
0.9888259 100(100 − 2) 1
s
(99)(2) 4.058433 1.293714 0
0.9888259 − (3.089203) 0 1 ≤ µ2 and
100(98) 1.293714 9.390374 1
s
(99)(2) 4.058433 1.293714 0
0.9888259 + (3.089203) 0 1 ≥ µ2
100(98) 1.293714 9.390374 1
s s
(99)(2) 1.293714 (99)(2) 1.293714
0.9888259 − (3.089203) 0 1 ≤ µ1 ≤ 0.9888259 + (3.089203) 0 1
100(98) 9.390374 100(98) 9.390374
s s
(99)(2) (99)(2)
0.9888259 − (3.089203)(9.390374) ≤ µ2 ≤ 0.9888259 + (3.089203)(9.390374)
100(98) 100(98)
√ √
0.9888259 − 0.2841593301 ≤ µ2 ≤ 0.9888259 + 0.2841593301
0.9888259 − 0.7655688004 ≤ µ2 ≤ 0.9888259 + 0.7655688004
0.2232570996 ≤ µ2 ≤ 1.7543947
0.22326 ≤ µ2 ≤ 1.7544 (5 signficant figures)
11