Let us consider a discrete random variable X with a probability function of the form f (x)
Question:
Let us consider a discrete random variable X with a probability function of the form f (x) = cx2, x ∈ RX = {1, 2,…, n}, for a suitable constant
c. The following sequence of commands enables us to find the value of
c, and subsequently the mean and variance of X.
In[1]:= f1[x_]:=x ̂ 2 a=Sum[f1[x], {x,1,n}];
Print["Constant c should be "];c=1/a f[x_]:=f1[x]/a Print["The probability function is"];
Print[f[x]]
Print["The mean of the distribution is"];
mu=Sum[x*f[x],{x,1,n}]
Print["The variance of the distribution is"];
var=Sum[(x ̂ 2)*f[x],{x,1,n}]-mu ̂ 2 Constant c should be Out[3]= 6/(n (1+n) (1+2 n))
The probability function is (6 x ̂ 2)/(n (1+n) (1+2 n))
The mean of the distribution is Out[8]= (3 n (1+n))/(2 (1+2 n))
The variance of the distribution is Out[10]= -((9 n ̂2 (1+n) ̂ 2)/(4 (1+2 n)̂ 2))+1/5 (-1+3 n+3 n̂ 2)
Note that Mathematica finds the sums above using closed-form expressions in terms of the parameter n. For a specific value of n, we can draw the graph of the probability function f as follows:
In[1]:= n=20;
Print["The probability function for n= ", n, " is as follows"]
pdftable=Table[{x,f[x]},{x,1,n}]
Print["Plot of the probability function"]
ListPlot[pdftable]
The probability function for n= 20 is as follows:
Out[3]= {{1,1/2870},{2,2/1435},{3,9/2870},{4,8/1435},{5,5/574}, {6,18/1435},{7,7/410},{8,32/1435},{9,81/2870},{10,10/287}, {11,121/2870},{12,72/1435},{13,169/2870},{14,14/205}, {15,45/574},{16,128/1435},{17,289/2870},{18,162/1435}, {19,361/2870},{20,40/287}}
Plot of the probability function Out[15]=
Modifying appropriately the sequence of commands above, do the same for each of the following discrete distributions:
(i) f (x) = c(x + 10), RX = {0, 1, 2,…, 100};
(ii) f (x) = c(x + 15)2, RX = {−30,−29,−28,…,+10};
(iii) f (x) = c ⋅ 3x∕4x, RX = {1, 2, 3, …};
(iv) f (x) = c ⋅ 5x∕x!, RX = {0, 1, 2, …};
(v) f (x) = c∕x2, RX = {1, 2,…}.
Step by Step Answer:
Introduction To Probability Volume 2
ISBN: 9781118123331
1st Edition
Authors: Narayanaswamy Balakrishnan, Markos V. Koutras, Konstadinos G. Politis