Theoretical mean(Z) = \[ E(Z) = E(X) + E(Y) = \frac{1}{2}(a+b) + \frac{1}{2}(a+b) = 1 \] Theoretical variance(Z) = \[Var(Z) = Var(X) + Var(Y) = \frac{1}{12}(b-a)^{2} + \frac{1}{12}(b-a)^{2} = \frac{1}{6} \]
2)
x<-runif(100)
y<-runif(100)
z<-x+y
mean(z)
## [1] 1.052499
var(z)
## [1] 0.184626
The simulation is close to both the theory mean and variance
3)
hist(z)
No, it is not reasonable assume that Z is a uniform distribution, It looks somewhat normal.
W = x-y
mean(W)
## [1] -0.01993658
var(W)
## [1] 0.1593246
hist(W)
Theoretical mean(W) = \[ E(W) = E(X) - E(Y) = \frac{1}{2}(a+b) - \frac{1}{2}(a+b) = 0 \] Theoretical variance(W) = \[Var(W) = Var(X) + Var(Y) = \frac{1}{12}(b-a)^{2} + \frac{1}{12}(b-a)^{2} = \frac{1}{6} \]
Again, the simulation is a decent estimate for the mean and the variance
5)
K <- x*y
hist(K)
This does not look like a uniform distribution! This almost looks like a poisson distribution!
6)
R <- x/y
hist(R)
This does not look like a unifrom distribution!
9.2)
\[ E(Y) \approx g(\mu_{x}) \] \[ Var(Y) \approx (g'(\mu_{x}))^{2}\sigma_{x}^{2} \]
X = runif(300, min = 1, max =3)
Y = X^2
mean(Y)
## [1] 4.107067
var(Y)
## [1] 5.209197
hist(Y)
9.3)
\[ E(Y) = \frac{1}{\mu_{x}} \] \[ Var(Y) = -\frac{1}{\mu_{x}^{2}}(\sigma_{x})^{2}\]