2k views

### Logistic regression simulation in order to show that intercept is biased when Y=1 is rare [duplicate]

I'm trying to simulate a logistic regression. My goal is showing that if Y=1 is rare, than the intercept is biased. In my R script I define the logistic regression ...
2k views

### How to simulate a binary response variable based on two non-interacting continuous variables [duplicate]

I want to simulate a binary response variable which depends on two normally distributed continuous variables, and I want to have more 1s than 0s in the response variable. I wonder how this can be done ...
28 views

### How to simulate errors from any regression model? [duplicate]

I am trying to wrap my head around this: Other than a standard linear regression model, we almost never know the theoretical distributions of the error terms Thus, how do we simulate random errors ...
22k views

### Logistic regression in R resulted in perfect separation (Hauck-Donner phenomenon). Now what? [duplicate]

I'm trying to predict a binary outcome using 50 continuous explanatory variables (the range of most of the variables is $-\infty$ to $\infty$). My data set has almost 24,000 rows. When I run ...
• 773
15k views

### Generate random correlated data between a binary and a continuous variable

I want to generate two variables. One is binary outcome variable (say success / failure) and the other is age in years. I want age to be positively correlated with success. For example there should be ...
• 7,271
18k views

### Generate data samples from Poisson regression

I was wondering how you would generate data from a Poisson regression equation in R? I'm kind of confused how to approach the problem. So if I assume we have two predictors $X_1$ and $X_2$ which are ...
• 2,471
10k views

### Simulating data for logistic regression with a categorical variable

I was trying to create some test data for logistic regression and I found this post How to simulate artificial data for logistic regression? It is a nice answer but it creates only continuous ...
• 243
2k views

### What exactly does a proper scoring rule want to do?

I will adapt an excellent simulation by our Stéphane Laurent for this question. ...
• 65.2k
3k views

### How to generate data for logistic regression with an independent variable that is not centred?

In this post, there is a script to generate data for a logistic regression. ...
• 1,225
348 views

### Linear probability model with crossentropy (log) loss

For better or for worse, some people shoehorn binary $y$ variables into an ordinary least squares linear regression. $$\mathbb E[Y\vert X]=\hat y=X\beta$$ If we encode the $y_i$ as either $0$ or $1$,...
• 65.2k
2k views

### Logistic regression - how to interpret my graph?

I evaluated a logistic regression using mnrfit function in Matlab. However, I am not sure if I did this correctly, because my graph does not looks like standard logistic regression. The image below ...
2k views

1 vote
416 views

### Why can you not estimate Beta with least squares in logistic regression? [duplicate]

As the title says, why can you not estimate Beta (coefficients) in logistic regression with least-squares? I read in a book that it is not possible and that we use maximum likelihood instead, but I ...
412 views

### simulated data of Poisson Distribution?

I was developing a set of simulated data of the following properties. def <- defData(def, varname = "GT", dist = "poisson", formula = "0.14 * BB", link = "log&...
• 199
1 vote
267 views

### simulate sub group data for logistic regression

I want to simulate a data set for logistic regression in which my $Y_i \sim Bin(n_i, p_i)$ and $n_i >1 ~ \forall i$. I want something like: In another question, data has been generated for a ...
• 1,501
341 views

### How to generate binary outcome data where ridge or lasso outperforms simple logistic regression?

The answer is very easy to the question in the title, we just need a data set where $n<p$; thus, logistic regression MLE does not exist. Also if perfect separation occurs, ridge or lasso will be ...
• 51
234 views

### simulate artificial data for regression with a specific P value for y~x

I would like to simulate a dataset to perform simulations with - I would like to set a specific P value a priori and not perse the beta-coefficient, so that I can do follow-up simulations. So taking ...
• 255
178 views

### Making linear to logistic regression with sigmoid function - why is a transformation of predicted y needed?

I noticed that one can run a linear regression for binary outcomes and get the same predictions as from a logistic regression after using a sigmoid function. That is what I awaited. But the surprising ...
• 341
113 views

### What would be an effective strategy to correlate congressional attendance and precipitation?

I have data sets of the attendance of congresspeople, and of the weather in Washington, DC. I would like to examine whether and to what degree precipitation is correlated with the likelihood of ...
• 103
1 vote
271 views

### Why do ML models learn probability distributions and why does it matter?

I'm aware that this question is quite silly, but I've done reading and coded NNs for quite a while now, studied backpropagation and so on. However, I don't think I ever understood what is the ...
• 174
143 views

### Is it possible to have a extremely low l2-loss while having accuracy at chance level?

I was trying to train a Neural network ReLus to learn to learn to predict boolean functions (with +1, -1 instead of 0,1). In particular I tried the parity function which is just the product function ...
• 6,936
111 views

### simulation of logistic regression sensitivity to prior probability: Brier score vs accuracy

I wrote a simulation in R that compares performance of a logistic regression as I vary the prior probability of the two classes. The gist is that I do a simulation of data that generates nearly ...
• 65.2k
105 views

### Simulating logistic regression data for continuous by three-level categorical model

I am attempting to simulate data for a logistic regression model testing a continuous interaction with a three-level categorical factor. However, I am encountering a little bit of difficulty. When I ...
• 1,027
59 views

### How to simulate artifical data for multinomial regression? [duplicate]

I want to use some predictors (for example, $x_1$ and $x_2$ below) to simulate the multinomial outcome (for example, with 3 levels). Below are the codes I found in another question regarding ...