2
$\begingroup$

I have a list of marks scored by students in Science (X, between 0 to 100%) and whether they went to college to or not (Y).
High marks in science showed a higher concentration of college admits and low marks had the second best hit rate (students went for Arts degree, etc). Scores in the intermediate range had a lower hit rate. Most students have lower scores in Science.

I divided my sample into

5 bins: 0-10, 10-20, 20-80, 80-90, 90-100.

Found Chi-Sq to be significant.

I transformed these bins into dummy categorical variables and then calculated LR coeff which were significant for 80-90, 90-100(+ives), and 0-10(-ive). I concluded that when scores are higher, the odds of getting admissions are high. When scores are low, it is unlikely that the student would go to college.

Q1. Should I instead use marks as continuous variable? My main hypothesis is: highest marks result in college admissions, while the lowest marks imply no college admission.

Q2. The data was linear before. However, what if the data was shown in the chart below, do you think categorizing it made more sense? Event hit rates are higher for a particular range and then trail off. Categorizing it in bins helps as I just to have to analyze the performance of that bin (main focus of the study). May be using dummy variables removes the affect of non-linear relationships?

enter image description here

$\endgroup$
3
$\begingroup$

Yes, you should always use a continuous variable as a continuous variable. There is little reason to ever categorize a continuous variable into bins. If you like, you may want to read my answer here: How to choose between ANOVA and ANCOVA in a designed experiment, which discusses this in greater detail.

$\endgroup$
  • 1
    $\begingroup$ I would challenge whether marks are continuous though. Ever seen a teacher give $\frac {1}{\sqrt {2}} $ marks for a question? Marks are usually given as discrete chunks for demonstrating understanding of varies pieces of course content. However, your advice about not grouping still applies though. $\endgroup$ – probabilityislogic Apr 26 '14 at 8:41
  • 1
    $\begingroup$ @probabilityislogic, you're right, but 1) data are always discrete in practice, 2) I sometimes give marks of $\pi$, $e$, or $\phi$, just for the fun of it, eg on April 1st (& then there's this), & 3) I was taking / using "continuous" here as a synonym for quantitative / not categorical, which I think is sufficiently true even if marks are always "given as discrete chunks for demonstrating understanding of varies pieces of course content". $\endgroup$ – gung - Reinstate Monica Apr 26 '14 at 14:28
  • 1
    $\begingroup$ @probabilityislogic: The important property is that distances between marks are intended to be measured in equivalent units, such that 82 is twice as far from 80 as 81, for example. Fractional marks don't have to occur for the data to have this structure (at least, not for those assigning marks to intend this structure in the meanings of their marks). Anyway, I think it's somewhat irrelevant whether the population of marks are truly continuous. The main issue is information loss; consequences would be similar for a reduction in number of ordinal categories. $\endgroup$ – Nick Stauner Apr 28 '14 at 7:51
  • $\begingroup$ @gung I guess you are right about not converting continuous to categorical bins in this case where universe is between 0-100. Intercept also means something. However, imagine if the continuous predictor was between -infinity to +100. Earlier, I converted everything into bins: -infinity to -25, -25 to -10, -10 to 0, 0 to 10, .... It made sense as my hypothesis focused on proving -10 to 0 bin has higher probability of events while 0 to 10 behaved in the opposite way. With continuous predictor, I'd now have: decrease in X increases causes the event. Explaining intercept at X=0 will be tricky! $\endgroup$ – Maddy Apr 30 '14 at 21:31
  • 1
    $\begingroup$ @Maddy, that isn't really correct. There is basically no case where you need to bin. What you could do is fit spline terms. The idea is discussed in the answer I link above. $\endgroup$ – gung - Reinstate Monica May 1 '14 at 1:46
2
$\begingroup$

Here's a demonstration in of how @gung's answer applies in logistic regression.

First, a function for simulating data and printing logistic regression summaries using continuous and binned versions of the predictor. Outcome probability is a function of the uniformly distributed predictor. Change n to suit your sample size and runif to suit your theoretical distribution if you like.

thesims=function(n=30,seed=1){set.seed(seed);marks=runif(n,0,100)
admitted=rbinom(n,1,marks/100);binned=c();for(i in 1:n)
{if(marks[i]<10){binned[i]=1}else if(marks[i]<20){binned[i]=2}else
if(marks[i]<80){binned[i]=3}else if(marks[i]<90){binned[i]=4}else{binned[i]=5}}
print(summary(glm(admitted~marks,family='binomial'))$coef[2,3:4])
summary(glm(admitted~binned,family='binomial'))$coef[2,3:4]}

With the default $n=30$ and set.seed(1), the continuous predictor is clearly significant $(z=2.77,p=.006)$, but the binned predictor is very far from it $(z=.01,p=.994)$. This is a pretty extreme difference, but all other seeds will still produce a weaker result for the binned predictor.

Here's a way of visualizing the difference in the same simulated data as above. With continuous data:

require(ggplot2);ggplot(data.frame(marks,admitted),aes(x=marks,y=admitted))+
scale_x_continuous('Marks')+scale_y_continuous('Probability of admission',lim=0:1)+
geom_point(position=position_jitter(width=0,height=.04))+
stat_smooth(method='glm',family='binomial')

Things look as they should...but with binned data:

ggplot(data.frame(admitted,binned),aes(x=binned,y=admitted))+
scale_x_continuous('Binned marks')+scale_y_continuous('Probability of admission',lim=0:1)+
geom_point(position=position_jitter(width=0,height=.04))+
stat_smooth(method='glm',family='binomial')

Fitted probabilities of zero or one are bad news. Again, this is an extreme example, but you will generally find wider confidence bands with binned data. This is to be expected because you're effectively throwing away useful information by binning.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.