Joint Density Functions

In probability theory and statistics, joint density functions are a crucial concept, especially in the realm of multivariate distributions. They are employed to describe the likelihood that two or more random variables take specific values at the same time.

Joint Probability Density Function (PDF)

A joint density assigns probability to regions of values through integration. For a rectangle with limits a,b for X and c,d for Y, the probability is

P(a \leq X \leq b, c \leq Y \leq d) = \int_{a}^{b} \int_{c}^{d} f_{X,Y}(x, y) \, dy \, dx

For the joint density function f_{X,Y} to be valid, it must satisfy the following properties:

  1. Non-negativity: f_{X,Y}(x, y) \geq 0 for all x, y.
  2. Normalized: The total integral of the density function over all possible values must equal 1:
\int_{-\infty}^{\infty} \int_{-\infty}^{\infty} f_{X,Y}(x, y) \, dy \, dx = 1
Bivariate normal probabilities StockSharp JS-Charts

The joint cumulative probability uses the two upper boundaries. The rectangle probability also uses the two lower boundaries.

Loading calculator…

Marginal Density Functions

Given a joint density function of two random variables, we can extract the marginal densities of each variable by integrating the joint density over the range of the other variable. For a joint density function f_{X,Y}(x, y), the marginal densities f_X(x) and f_Y(y) are given by:

f_X(x) = \int_{-\infty}^{\infty} f_{X,Y}(x, y) \, dy
f_Y(y) = \int_{-\infty}^{\infty} f_{X,Y}(x, y) \, dx

A marginal density describes one variable after integrating over the other. The variables can still be dependent.

Conditional Density Functions

The conditional density function provides the density of one variable given that the other variable takes a specific value. If we want the density of X given Y = y, denoted by f_{X|Y}(x|y), we use:

f_{X|Y}(x|y) = \frac{f_{X,Y}(x, y)}{f_Y(y)}

Similarly, for Y given X = x:

f_{Y|X}(y|x) = \frac{f_{X,Y}(x, y)}{f_X(x)}

These conditional densities can reveal dependencies between the variables.

Independence of Random Variables

Two random variables X and Y are considered independent if their joint density function can be expressed as the product of their marginal densities:

f_{X,Y}(x, y) = f_X(x) \cdot f_Y(y)

Independence implies that knowing the value of one variable provides no information about the other.

Expectations and Moments

The expectation of a function g(X, Y) with respect to the joint density function f_{X,Y}(x, y) is given by:

E[g(X, Y)] = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} g(x, y) f_{X,Y}(x, y) \, dy \, dx

The normal example evaluates g(x,y)=xy. Its expected product is E[XY]=\mu_X\mu_Y+\rho\sigma_X\sigma_Y.

Important moments such as the mean and variance can be derived using the joint density function.

Covariance and Correlation

The covariance measures the joint variability of X and Y:

\text{Cov}(X, Y) = E[(X - E[X])(Y - E[Y])]

Using joint density, it is expressed as:

\text{Cov}(X, Y) = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} (x - \mu_X)(y - \mu_Y) f_{X,Y}(x, y) \, dy \, dx

The correlation coefficient is the standardized measure of this covariance:

\rho_{X,Y} = \frac{\text{Cov}(X, Y)}{\sigma_X \sigma_Y}
BTC/USD Benchmark ETH/USD Daily candles Kraken
StockSharp JS-Charts

Each point is the Pearson correlation of BTC/USD and ETH/USD simple daily returns over the selected number of matched days.

Loading candle history…

where \sigma_X and \sigma_Y are the standard deviations of X and Y.

Applications in Algorithmic Trading

In algorithmic trading, joint density functions can be employed in various ways, including:

  1. Risk Management: Understanding the joint distribution of asset returns is crucial for portfolio optimization and risk assessment. For example, the joint density function of stock returns and market indices helps in identifying hedging strategies.

  2. Option Pricing: The valuation of multi-asset options can rely on the joint distribution of underlying asset prices. Models like the multivariate Black-Scholes use joint densities to price basket options.

  3. Statistical Arbitrage: Joint densities can be used to identify and exploit statistical relationships between different assets or financial instruments.

  4. Machine Learning Models: In financial modeling, joint density estimation can improve the performance of models predicting asset prices by capturing dependencies between variables.

Example: Gaussian Copula

A bivariate normal pair has means \mu_X,\mu_Y, positive standard deviations \sigma_X,\sigma_Y, and correlation \rho between −1 and 1. The standardized coordinates are z=(x-\mu_X)/\sigma_X and w=(y-\mu_Y)/\sigma_Y. Penn State STAT 505

f_{X,Y}(x,y)=\frac{1}{2\pi\sigma_X\sigma_Y\sqrt{1-\rho^2}} \exp\left(-\frac{z^2-2\rho zw+w^2}{2(1-\rho^2)}\right)

For the conditional density given Y=y, the mean is \mu_X+\rho\sigma_Xw and the variance is \sigma_X^2(1-\rho^2). Setting \rho=0 makes the normal marginals independent. Penn State STAT 505

To obtain the Gaussian copula, transform the standardized normal variables into uniform variables u=\Phi(z) and v=\Phi(w). Divide the standardized joint density \phi_\rho(z,w) by the two standard normal marginal densities.

c_\rho(u,v)=\frac{\phi_\rho(\Phi^{-1}(u),\Phi^{-1}(v))} {\phi(\Phi^{-1}(u))\phi(\Phi^{-1}(v))}
Bivariate normal densities StockSharp JS-Charts

Adjust the two means, standard deviations and correlation. The plot varies X while the chosen Y is held fixed.

Loading calculator…

Conclusion

Understanding joint density functions is foundational for dealing with multivariate data in probability and statistics. In the context of algorithmic trading, these concepts are vital for modeling asset returns, developing trading strategies, and managing risk effectively. The ability to analyze and comprehend the joint behavior of multiple financial variables offers a significant advantage in the competitive landscape of algorithmic trading.