import numpy as np
import matplotlib.pyplot as plt
def get_Y(m,x_min,x_max):
Y = np.array([]);
for i in range(100000):
X = np.random.uniform(x_min,x_max,m)
Y = np.append(Y,np.sum(X))
return Y
def get_y_exponential(m,lambd):
Y = np.array([]);
for i in range(100000):
X = np.random.exponential(lambd,size=m)
Y = np.append(Y,np.sum(X))
return Y
def get_bins_and_prob(RV,N):
f,b = np.histogram(RV,bins=N) # f=frequency, b=bins
sumf = float(f.sum())
p = f/sumf #probability
return b,p
#print(probs.sum()) # 1.0
def get_pmf(RV,N):
b,probs = get_bins_and_prob(RV,N)
b1 = b[1]
b0 = b[0]
b_1 = b[:-1]
bins = 0.5*(b1-b0) + b_1
plt.figure
plt.bar(bins,probs, 1.0/N)
plt.show()
nbins = 60
# uniform random variable
#A
y = get_Y(10,-0.5,0.5)
get_pmf(y,nbins)
#B
y = get_Y(100,-0.15,0.15)
get_pmf(y,nbins)
#C
y = get_Y(1000,-0.05,0.05)
get_pmf(y,nbins)
#D
#exponentials random variable
y = get_y_exponential(10,3)
get_pmf(y,nbins)
COMMENT DOWN FOR ANY QUERY RELATED TO THIS ANSWER,
IF YOU'RE SATISFIED, GIVE A THUMBS UP
~yc~
python coding please 1.2 Sum of the Independent Random Variables Consider a set of 'n random variables XI,Xy . . . Х,, . Let's define the random variable Y as the stinmation of all X, var...
Problem 4 Let X and y be independent Poisson(A) and Poisson(A2) random variables, respectively. i. Write an expression for the PMF of Z -X + Y. i.e.. pz[n] for all possible n. ii. Write an expression for the conditional PMF of X given that Z-n, i.e.. pxjz[kn for all possible k. Which random variable has the same PMF, i.e., is this PMF that of a Bernoulli, binomial, Poisson, geometric, or uniform random variable (which assumes all possible values with equal...
please be clear and solved all Let X and Y be two Independent random variables such that V(X) =1 and V(Y) =2. Then V(3X-2Y+5) is equal: a. 25 b. 20 17 d. 15 C. O a d Let X and Y be two random variables such that E(X) = 2, E(Y) = 5 and E(XY)=7. The covariance of (X, Y) is equal to: a. 17 b. 14 c. 3 d. -3 a O с Od Question 3* 10 points Light...
1. Suppose that random variables X and Y are independent and have the following properties: E(X) = 5, Var(X) = 2, E(Y ) = −2, E(Y 2) = 7. Compute the following. (a) E(X + Y ). (b) Var(2X − 3Y ) (c) E(X2 + 5) (d) The standard deviation of Y . 2. Consider the following data set: �x = {90, 88, 93, 87, 85, 95, 92} (a) Compute x¯. (b) Compute the standard deviation of this set. 3....