Statistics

Statistics are very useful to model uncertainty, find relationships between two different variables and quantify risk.

Random variable: is a variable whose value is subject to variations due to randomness, like the result of a dice (discrete variable) or the returns on a stock (continuous variable).

Example:

Discrete variable (finite number of possibilities)
$X$ = Result of tossing a coin
$X_{1}$ = Head
$X_{2}$ = Tail

Continuous variable (infinite number of possibilities)
$Y$ = Average weight of a class

Probability: relative frequency of the outcomes of a random variable.

Example:
$X$ = Result of tossing a coin
$X_{1}$ = Head, $P_{1} = 0.5$
$X_{2}$ = Tail, $P_{2} =0.5$

Note:
$P_{i} \geq 0 \forall i $
$\sum_{i=1}^nP_{i}=1$, with n possible events.

Average:
Weighted average (with probability) of all possible events.
$$\overline{X}=\sum_{i=1}^nP_{i}X_{i}$$

Example:
Possible returns on a stock:
$X_{1} = 1%$, $P_{1} = 0.25$
$X_{2} = 2%$, $P_{2} =0.5$
$X_{2} = 3%$, $P_{2} =0.25$

$\overline{X}=\sum_{i=1}^nP_{i}X_{i}=1%0.25+2%0.5+3%0.25$

Variance:
We are not only interested in the average return of a stock, we are also interested in how much returns vary. To measure variability we use the variance:
$$Var(X)=\sigma_{X}^2=\sum_{i=1}^nP_{i}(X_{i}-\overline{X})^2$$

Example:
Possible returns on a stock:
$X_{1} = 1%$, $P_{1} = 0.25$
$X_{2} = 2%$, $P_{2} =0.5$
$X_{2} = 3%$, $P_{2} =0.25$
$\sigma_{X}^2=\sum_{i=1}^nP_{i}(X_{i}-\overline{X})^2=0.25(1-2)^2+0.5(2-2)^2+0.25(3-2)^2=0.5%^2$

Standard deviation:
The problem with the variance is that the units are not the same thant the mean's units
$$SD(X)=\sigma_{X}=\sqrt{\sigma_{X}^2}$$

Example:
Possible returns on a stock:
$X_{1} = 1%$, $P_{1} = 0.25$
$X_{2} = 2%$, $P_{2} =0.5$
$X_{2} = 3%$, $P_{2} =0.25$
$\sigma_{X}=\sqrt{\sigma_{X}^2}=\sqrt{0.5}=0.707$

Covariance:
When we construct portfolios of stocks one of the important things of interest is how the stocks move together. The covariance of two random variables, x and y can be calculated as follows:

$$Cov(X,Y)=\sigma_{X,Y}=\sum_{i=1}^nP_{i}(X_{i}-\overline{X})(Y_{i}-\overline{Y})$$

Example 1:
Possible returns on two stock:
$X_{1} = 1%$, $Y_{1} = 2%$, $P_{1} = 0.5$
$X_{2} = 3%$, $X_{2} = 6%$, $P_{2} = 0.5$
$Cov(X,Y)=0.5(1-2)(2-3)+0.5(3-2)(6-3)=2>0$

Example 2:
Possible returns on two stock:
$X_{1} = 1%$, $Y_{1} = 6%$, $P_{1} = 0.5$
$X_{2} = 3%$, $X_{2} = 3%$, $P_{2} = 0.5$
$Cov(X,Y)=0.5(1-2)(6-3)+0.5(3-2)(2-3)=-2<0$

If the covariance is positive, the random variables move together in the same direction. On the other hand, if the covariance is negative, the random variables move together in opposite directions.If the covariance is equal to zero, the random variables are independent.

Correlation:
The problem with the covariance is that the magnitude depends on the units of measurement. The correlation of two random variables, x and y can be calculated as follows:

$$Corr(X,Y)=\rho_{X,Y}=\frac{Cov(X,Y)}{SD(X)SD(Y)}$$
$$-1\leq \rho_{X,Y}\leq+1$$

$\rho_{X,Y}=+1\rightarrow$ the two variables are perfectly positively correlated. They move always in the same direction in proportion.
$\rho_{X,Y}=-1\rightarrow$ the two variables are perfectly negatively correlated. They move always in the opposite direction in proportion.
$\rho_{X,Y}=0\rightarrow$ the two variables, on average, do not move together or in opposite directions.
 
Regression:
Suppose we have two random variables and we plot them on a diagram. Regression theory allows us to fit a line $Y=A+BX$ representing how the two variables are related.

$$B=Slope=\frac{Cov(X,Y)}{Var(X)}$$
$$A=Intercept=\overline{Y}-B\overline{X}$$

File:Linear regression.svg

No comments:

Post a Comment