# Linear regression on grouped data

I have a sample composed by 200.000 projects. Each project is defined according to its size ($S$) and the presence of active users ($U$). The values for $S$ are greater than zero; on the other hand, $U$ is a binary variable (1 if the project has active users, 0 otherwise).

I would like to check if $S$ and $U$ are related each other.

Since I was not able to find a direct relation between $S$ and $U$, I've ordered the projects according to their sizes (ascending order). Then I've grouped the projects in 10 groups (20.000 projects per group), and for each group, I've counted the number of projects having active users.

Since it seems that the number of projects having active users increases from one group to the next one, I would like to know how to proceed. It makes sense to run a linear regression analysis between the sum of project sizes per group and the number of active users per group? I should use a correlation test? • Why are there 12 points? What is the underlying question of interest? May 11, 2014 at 23:54

(I can't comment yet.) I'm assuming you tried a t-test or a non-parametric version, or those tests don't answer your question. In addition to your linear regression approach, you might also consider a logistic regression on the ungrouped data, which would avoid the possibly arbitrary grouping step.

• thanks for answering, why I should run the Mann-Whitney-Wilcoxon test, in this case? Apr 7, 2014 at 17:39

So, to rephrase, you want to know if the size $S$ of active projects ($U=1$) is greater than that of inactive ones ($U=0$)? And you don't have any other information on any of the projects?

In that case, your analysis is a simple unpaired t test, comparing the size of the active projects to the inactive ones - no need for regression, correlation, or arbitrary groupings.

I agree with user42628 that grouping doesn't help here much and that logistic regression sounds like a good idea with this data. In this approach you would predict if the project have active users by its size. It is better approach that correlation (that is problematic because one of your variables is binary), because it also gives you more information that just strength of relation between those variables.

I personally wouldn't use t-test because it would only tell you if both groups differ, on average, in size - as for me it doesn't sound interesting. With logistic regression you would know how size (or its log) influences a probability of having active users.

Also, form your plot I see that there is an outlier in your data (lower right corner of the plot), so you have to decide what to do with it. It will certainly influence your results. But this is a different topic.