Professional Documents
Culture Documents
Submitted by: Tasnim Sorwar Roll:SN-42 Tasnim Zerin Tushi Roll:RK-65 Mariam Farzana Roll:SN-72 Sadia Sultana Roll:RK-32 Homework description: Generating two random variables for the following cases: 1. No correlation between these two RVs. 2. Desired correlation between them. 3. Perfect correlation between them.
Theory:
Random Variable:A Random Variable is a function, which assigns unique
numerical values to all possible outcomes of a random experiment under fixed conditions. A random variable is not a variable but rather a function that maps events to numbers. Suppose that a coin is tossed three times and the sequence of heads and tails is noted.The sample space for this experiment evaluates to: S={HHH, HHT, HTH, HTT, THH, THT,TTH, TTT}. Now let the random variable X be the number of heads in three coin tosses. X assigns each outcome in S a number from the set.Then Sx={0, 1, 2,3}. The list below lists the eight outcomes of S and the corresponding values of X.
Outcomes
HHH 3 HHT 2 HTH 2 THH 2 HTT 1 THT 1 TTH 1 TTT 0 X is then a random variable taking on values in the set Sx = {0, 1, 2, 3}.
Correlation:
Correlation is a statistical measurement of the extent of the linear relationship between two variables. Possible correlations range from +1 to 1. A zero correlation indicates that there is no relationship between the variables. A correlation of 1 indicates a perfect negative correlation, meaning that as one variable goes up, the other goes down. A correlation of +1 indicates a perfect positive correlation, meaning that both variables move in the same direction together.
Where r is the correlation coefficient in (X,Y).We can consider 3 cases for the value of it. 1.If r=0,then the random variables are said to be uncorrelated. Clearly, independent random variables are said to be uncorrelated. 2.If the value of r remains between 0 and 1,then we can get a desired correlation which is neither perfect nor uncorrelated. 3.If r=1,then the random variables are said to be perfect correlated.
Where U~N(0,1) ,V~N(0,1) and U and V are independent. The transformation can be used to generate realizations of a standard bivariate Gaussian random vector.
Fig:1
Generate two random variable with correlation coefficient =.9 u=rand(1,100); v=rand(1,100); rho=.9; x=u; y=(rho*u+sqrt(1-rho^2)*v); plot(x,y,'.') The figure is shown below,
Fig:2
Generate random variable with perfect correlation, u=rand(1,100); v=rand(1,100); rho=1; x=u; y=(rho*u+sqrt(1-rho^2)*v); plot(x,y,'.') The figure is given below,
Fig:3