Question: MATLAB and stats/possibilities help: Linear combination of two discrete random variables Suppose we have two independent random variables N1 and N2 that are described by

MATLAB and stats/possibilities help:

Linear combination of two discrete random variables

Suppose we have two independent random variables N1 and N2 that are described by probability mass functions (PMFs) P1(k) and P2(k) which are defined on the domains k=0, 1, 2, ..., n1 and k=0, 1, 2, ..., n2 respectively for some positive integers n1 and n2. A new random variable M is created as a linear combination of N1 and N2 of the form M=a*N1+b*N2 for positive constants a and b. Write a function that takes as inputs the probability mass functions P1 and P2 and the combination coefficients a and b and produces as an output, the PMF of the random variable M.

My understanding for this problem is that given P1, P2,a, and b. Find the M of which you get from a*N1+b*N2, and you get N1 N2 from P1 and P2 which P1 and P2 are PMF of N1 and N2 correspondingly. and you have to find all possible values for N1 and N2 from P1 and P2 and put them in the function. not sure how to implement this in MATLAB, please help

MATLAB and stats/possibilities help: Linear combination of two discrete random variables Suppose

function 1 2 P RVLinearCombinat ion (P1, P2, a, b) % enter the code for your function here. % P1 and P2 are row vectors that contain the two PMFs % You can infer the domain of the PMFs by the length of the vectors P1 and P2. % You may assume that a and b are positive integers. 4 5 6 7 end Code to call your function 1 RVLinearCombination (P1, P2, a, b) Assessment Uniform(4) Uniform(5) (Pretest) Test Code 1% Run learner solution. 2 a-1; 3 b-1; 4 P1-[1 1 1 1/4; 6, p RVLinearCombination(P1, P2, a, b); = % Run reference solution. 9 Psolution [1 2 3 4 4 3 2 1]/20; 10 11 % compare. 12 assessVariableEqual( "P'Psolution) function 1 2 P RVLinearCombinat ion (P1, P2, a, b) % enter the code for your function here. % P1 and P2 are row vectors that contain the two PMFs % You can infer the domain of the PMFs by the length of the vectors P1 and P2. % You may assume that a and b are positive integers. 4 5 6 7 end Code to call your function 1 RVLinearCombination (P1, P2, a, b) Assessment Uniform(4) Uniform(5) (Pretest) Test Code 1% Run learner solution. 2 a-1; 3 b-1; 4 P1-[1 1 1 1/4; 6, p RVLinearCombination(P1, P2, a, b); = % Run reference solution. 9 Psolution [1 2 3 4 4 3 2 1]/20; 10 11 % compare. 12 assessVariableEqual( "P'Psolution)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!