# Need help with understanding random variables/the data generating distribution

Lets say we want to predict a persons weight using their height and gender.

We always assume there is a data generating distribution $$P_{X×Y}$$, and all output and input pairs are generated i.i.d from $$P_{X×Y}$$. My question is:

1. How can I understand what X is? Is it discrete? Is it continuous? E.g. 1 sample is drawn from X. Is this a random vector containing the continuous random variable height and discrete random variable gender? What is the right way to show this mathematically? Something like $$X_1$$ ={H,G} where H and G are the height and gender random variables?

2. Similarly, how can I understand what $$P_{X×Y}$$? is? Is this the probability density for every possible sampling combination? E.g. one combination can be male, height of 180cm and 70kg?.

I'm still learning about random variables in general so any simple explanation will be greatly appreciated!

• For almost any conceivable purpose, question (1) is irrelevant. There is no mathematical demonstration because this is not a mathematical question. As far as (2) goes, could you explain what you mean by "understand"?
– whuber
Mar 26, 2021 at 15:35
• thanks for the response whuber. For 1) is my understanding correct that X is a random vector containing the random variables height and gender? I am just trying to understand how you'll define it in this case. For 2) Imagine if X and Y are jointly normal. Then Pxy can be thought of as their joint PDF, and we can understand it as the density of every 2d point. But now, since i'm not sure what X is I dont really understand what Pxy means. Hence, i'll like to know what your interpretation of what X and Pxy is. Mar 26, 2021 at 15:50

For the purpose of predicting a person's weight using their height and gender, we can think of three scalar random variables: gender (denote as $$X$$), height (denote as $$Y$$) and weight (denote as $$Z$$). So $$X$$ is discrete but $$Y$$ and $$Z$$ are continuous. You can also consider the joint probability distribution $$p(x, y, z)$$, which should be understood as $$p(x, y, z)dydz = P(X = x, y < Y < y + dy, z < Z < z + dz)$$. To predict a person's weight $$Z$$ using their height $$Y$$ and gender $$X$$, we can calculate the conditional distribution $$p(z| x, y)$$ and take its mean, median or mode as the estimate of $$Z$$.
In your question, I think you are putting height and gender into one single random vector (which you denote as $$X$$), which is perfectly fine. However, this could be confusing for you if you want to decide whether it is continuous or discrete, because it's really continuous along one dimension and discrete along the other.