# Understanding Bernoulli and logit function

currently I am reading a paper and trying too implement what is in the paper by myself. I plan to implement using R. I'm stuck at below part:

I understand the X and Z but I'm not familiar with Bernoulli and logit function. I only know what is Bernoulli from Bernoulli proocess (like in the basic probability class). I don't understand the meaning of Bernoulli in the paper like above and furthermore the logit.

Maybe you can help me explain what it is and how to implement it in R? Thank you.

Update, I have write the R code and I think it is working. In the paper, further, the writer said the sample size is fixed, n=1000. I have tried the function in R and I get this kind of output:

         1    2    3    4    5

T1   803  511  380  137  843

T2   819  528  348  100  839

Y    815  486  361  101  483


From what I expect, the logistic regression only accept output to be binary, either 0 or 1. In this problem, I expect the dependent variable Y should be 0 or 1 and the T1 and T2 probably as it is. Do I need to change the sample size for Y to only 1 and not 1000?

## 1 Answer

The random variables $Y$ (response), $T_1$ and $T_2$ are vectors of Bernoulli-distributed random variables.

That is the $i$th element of each has a Bernoulli distribution whose probability parameter depends on the $i$th element of $X$ in the indicated fashion.

The $\text{logit}$ function is simply $\text{logit}(p)=\log(\frac{p}{1-p})$.

It looks like it is setting up simulated data for some kind of logistic regression type of situation but there's not a lot of context here.

• Yes, this is a setup for a simulation to test for algorithm in this paper vs logistic regression. This is a simulation data for no relationship. What is the range for every number in Y, T1, and T2? I will update with my code I tried to write. Mind checking wether it is correct or not. Feb 8, 2016 at 2:19
• @Bharata Code review is nearly always off topic here. Feb 8, 2016 at 2:25
• Okay, so, what I understand is, first, generate the probability accrooding to logistic regression with Bj and X parameter. After that, generating random number with Bernoulli distribution with calculated probability. Is that right? Feb 8, 2016 at 2:40