Question
A random variable Z is defined in the following way (in statistics,Z is called a Gaussian mixture) X u=0 Y u=1 where u follows Bernoulli
A random variable Z is defined in the following way (in statistics,Z is called a Gaussian mixture)
X u=0
Y u=1
where u follows Bernoulli distribution with parameter p and p=Pr(u=1),
X~N(1, 1),Y~N(4, 1).
1. Create two R functions, PDFZ(p,z) and CDFZ(p,z), for calculating the PDF
and CDF of variable Z. Find PDFZ (0.6,2.5)andCDFZ(0.6,2.5). (Hint: thePDF
of Z is a weighted average of the PDFs of X and Y,same forCDF,i.e., fz=(1-p)fx+pfY,FZ=(1-p)FX+pFY)
2. Suppose p=0.6,draw thePDF and CDF curves of Z
3. Suppose p=0.6,generate10,000random samples of Z according to the definition ofZ (i.e.,generate u first,then generate Z based on the value of u). Estimate E(2) and E(Z^2) under p=0.6.
4. Suppose pis also random, p~Unif (0,1),generate10,000 random samples of Z and estimate E(Z) and E(Z^2).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started