Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

1. Let X be a random variable with a distribution function: si means when a) derivate F (by hand) in order to calculate the density of X b) Calculate E(X) and Var(X) (by hand) and provide details of...

1 answer below »
1. Let X be a random variable with a distribution function:
si means when
a) derivate F (by hand) in order to calculate the density of X
) Calculate E(X) and Var(X) (by hand) and provide details of your calculation
c) For all y ∈ (0, 1), calculate F −1 (y)
d) Use your answer in c) to write a code on MATLAB that simulates XXXXXXXXXXrandom variables for which the distribution function is given by F
e) Estimate E(X) and Var(X) on MATLAB and compare to answers found in b)
2. Let X be a random variable with a density :
si means when ;
                                 Sinon means otherwise
a) Find the density g of the uniform law [−1, 1] and a constant c* > 0 optimal (smallest value possible) that satisfies f(x) ≤ c*g(x) for all x ∈ [−1, 1]. In other words find :
Provide details and demonstrate that the critical point found is in fact a point that maximizes
) Using the reject algorithm and the constant c* found in a), write a MATLAB code that simulates a vector of XXXXXXXXXXrandom variables that have F as density
c) Estimate E(X) and Var(X) using MATLAB
3. a) Explain (by hand) how to use Monte Carlo simulation to estimate the following integral :
) Taking n = XXXXXXXXXX, write a MATLAB code that estimates the integral and give a confidence interval with a confidence level of 95%
c) Find the ‘’real value’’ of the integral using the integral function on MATLAB and compare it with the answer found in b
Answered Same Day May 16, 2021

Solution

Kshitij answered on May 20 2021
140 Votes
QdeSolution.m
% write a code on MATLAB that simulates 100 000 random variables for which
% the distribution function is given by F
N=100000
for ii=1:N
r=rand; % Random numbers from 0 to 3
if (
=0) || (
1)
y(ii)=
4;
elseif (
=1) || (
2)
y(ii)=1/4;
elseif (
=2) || (
3)
y(ii)=1/4+(3/4)*(r-2).^3;
end
end
plot(1:N,y); grid on
xlabel('x');
ylabel('distribution function F')
title('F(x)')
% The variance and expectation
E=mean(y);
V=var(y);
disp(['The Expectation E(x)=', num2str(E)]);
disp(['The Variance Var(x)=', num2str(V)]);
RejectionMethod_Fx.m
clc;
clear all;close all;
a=-1;
=1;
c=2.6603;
q=0;
for p=1:100000

u1=rand(1,1);
u2=rand(1,1);
x1=a+u1*(b-a);
y1=c*u2;
f=(2/pi)*sqrt(1-x1.^2);

while 1 && q<20
if y1<=f

x=x1;
scatter(x,f);
hold on;
end
q=q+1;
end
q=0;
end
xlabel('Number of Distribution (x)','fontsize',14);
ylabel('Probability Density Function (F(x))','fontsize',14);
title('Rejection Method for Normal Distribution','fontsize',14);
grid...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here