# Using Logistic Regression to simulate data

I want to simulate data of the form:

$$Z=e^{X_1+X_2}+X_3 + \epsilon$$

for i.i.d. $$X_1,X_2,X_3\sim\mathcal{U}(-1,1)$$ and $$\epsilon\sim\mathcal{N}(0,1)$$

I have (using R) generated 10,000 realisations of $$Z$$ and now want to associate them to a (binary) categorical variable $$Y$$ which takes values $$0$$ and $$1$$.

I've done this by using Logistic Regression - with the $$i^{\text{th}}$$ realisation denoted as $$Z_i$$ - I used the realisations of $$Z$$ as the log-odds by calculating the probability of $$Y=1$$ as

$$\frac{e^{Z_i}}{1+e^{Z_i}}$$

which in turn gives values in $$[0,1]$$.

My question is:

I've only seen Logistic Regression used when the log-odds is a linear function - am I allowed to do what I have done to attain a probability, despite my log-odds is not a linear function?

If not, what other methods are there so that I can simulate such data? (I am using R so I would be grateful if you could provide insight on what R can do)

Also, I have used this method for a data generating process with an interaction i.e. $$Y=X_1+X_2+X_1X_2+\epsilon$$.

• What's the goal of the simulation? There are many ways of relating a real valued variable $Z$ to a binary outcome. Sep 22, 2019 at 16:54
• @CloseToC I intend to train a GBM on the data and then use tools such as PDPs to then try identify interactions, in this case, between $X_1$ and $X_2$
– Naji
Sep 22, 2019 at 17:57

That said, the data-generating model does not correspond to a logistic regression model, so attempting to fit a logistic regression model on $$X_1$$, $$X_2$$, and $$X_3$$ will not allow you to recover the true model. If you fit a logistic regression model on $$e^{X_1+X_2}$$, $$X_3$$, and $$\epsilon$$, you would recover the true model (note that fitting a logistic regression model on just $$e^{X_1+X_2}$$ and $$X_3$$ will not recover the true model because of noncollapsibility).