Categorical independent variable and logistic regression

I am creating a logistic regression model as follows. The dependent variable is outcome of a game (Win/Lost) and the independent variable is the degree of MOON on the day of match. So when I take a match, I get the value of Moon in degrees (1 to 360).

I feel that degree is just a measurement from a fixed line of reference point and hence I have to consider the position of Moon as a categorical variable by dividing the 360 degrees into groups and noting the group in which Moon existed during a match.

So I divided the degrees into 12 groups of 30 degrees (based on sun sign) each and note the position of Moon.

Am I right? Can I still divide the whole 360 degrees into 27 divisions (83 or 249 divisions) to get exact information?

Can I have 27 or 83 possible outcome for a single categorical variable?

Let me know if I need to explain my question further.

As of now i have a sample of 900 entries.

Degree of the moon is not a categorical variable, it is a circular variable. The problem with using it as a continuous variable is not that it is

measurement from a fixed line of reference point

(most if not all measurements are from a fixed line of reference - height is measured from the ground) but that 359 is close to 0 and far from 180.

One method to deal with this would be to use sin(degree) or cos(degree) as your independent variable (a continuous one).

• for eg: I observed in my data that between 30 to 36 degrees, the outcome is WIN many times and from 36 to 42 i observe more LOST matches. Is it wrong to then group the degrees and find which group of Degrees are more beneficial for WIN ? – Ganes Pandya Feb 14 '13 at 12:32
• It is certainly wrong to group the data based on results without some thought as to why this is happening. That's called fishing. If you do that, all your results will be biased. You can only legitimately do something like that if you do it on a training set and then test it on a testing set. "If you torture the data long enough, it will confess to anything" - Ronald Coase – Peter Flom Feb 14 '13 at 12:37
• Well i grouped the degrees based on Sun sign before attempting any statistical analysis. As my question reads, My main Doubt was treating it as categorical or Not and if i can group them , can i keep 12 or 27 or 83 divisions with just a sample size of 900 matches. – Ganes Pandya Feb 14 '13 at 12:44
• If your initial hypothesis was "sun sign" then you should use "sun sign". The rest of what you are doing looks like fishing – Peter Flom Feb 14 '13 at 13:04
• I am not using sun signs because it would not have scientific background.. I wish to statistically take the indepedent variable and find if any relation exists. . Its a odd combination idea but my feeling is that if i can scientifically and statistically prove/ disprove it. – Ganes Pandya Feb 14 '13 at 13:51

Aside from the circularity issue and clever sin or cos transforms Peter Flom notes, it's fine to bin a continuous predictor into a categorical factor. The number of factor levels is not an issue so long as you have enough observations in each bin.

You may also find it helpful to create additional predictors, e.g., maybe a feature for right angles, and a feature for deviation from the nearest right angle. Or a zodiac feature. Or something else particular to your game.

• Sorry, but I disagree with it "being fine to bin a continuous predictor". Such binning inevitably loses power; it also invokes a sort of "magical thinking". I wrote about this on my blog in a post called perils of categorizing a continuous variable – Peter Flom Feb 14 '13 at 12:29
• If one is principled in choice of binning procedure, then binning can be a useful way to deal with predictor nonlinearity. It really depends on the predictor and the domain. – Jack Tanner Feb 14 '13 at 12:35
• OK, binning based on some theory (or principled choice) can be good, I agree (although I still might prefer a spline model with fixed knots). But what this person seems to be doing doesn't seem to be principled. e.g., if the variable is "age" then, for some purposes, "Under 18" and "18 and up" makes a lot of sense. I agree that it "depends on the predictor and the domain". – Peter Flom Feb 14 '13 at 12:39
• Exactly ! I am trying to find if any relation exists between Moons position and the outcome of a game. The astrological literature recommend s that we consider the position of moon by grouping the 360 degrees in groups totaling to 249. – Ganes Pandya Feb 14 '13 at 12:48
• This kind of trying 27 or 83 or 249 is exactly what @PeterFlom is wisely criticizing. It's arbitrary, non-principled, meaningless. But if you use exactly the binning rules in the astrological literature, then you can talk about your model in terms of the literature. – Jack Tanner Feb 14 '13 at 13:06