# generate data for logistic regression simple question

#### leo nidas

##### New Member
Hi there,

If I want to see how good can I estimate the coefs in the simple linear model y=b0+b1*x+e when X follows exponential with mean 3 (or whatever), and e is normal(0,10^2) I do the following algorithm:

STEP 1: I produce (say 100) numbers from N(0,10^2), i.e. "e"

STEP 2: I produce 100 numbers from exponential, i.e. "x"

STEP 3: I obtain y, using the equation y=20+3*x+e.

STEP 4: I have my data {y,x}. I apply regression and get the estimates of b0 and b1.

I want to do the same procedure for a logistic model. (Any example will do as long as I understand the procedure)

What I suppose is:

STEP 1: I produce 100 numbers from exponential

STEP 2: Produce 100 numbers between (-20,20)

STEP 3: Do the calculation p=exp(0.1+0.3*x)/(1+exp(0.1+0.3*x)) and get 100 p's

STEP 4: Produce each response Y from bernoulli with parameter p(i), i=1,2,...100.

And I have my data {Y,X} and I apply logistic regression and estimate b0,b1. But this doesn't seem to work.

Can anyone help me?? Thanks in advance!!

#### leo nidas

##### New Member
Sorry guys but the algorithm for the logistic regression is working fine (forget step one, I typed it wrong),

Thanks and sorry if I wasted anyone's time..