'How to generate a set of four variables with a specific coefficient of multiple determination?

Suppose that a data set needs to contain 100 observations of four quantitative variables: Y, X1, X2 and X3. The values of Y are fixed, while the values of X1, X2 and X3 can be anything.

Is there a way to generate the variables X1, X2 and X3 so that Y ~ X1 + X2 + X3 has a specific, predetermined coefficient of multiple determination?

The values of regression coefficients are not important.

I tried looking at similar questions posted on this website, but I was unable to adapt their solutions to my specific situation.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source