Dichotomising vs keeping categories in regression I'm doing an analysis to see if having children is associated with treatment outcome.
The children variable is categorical and takes values 0-7.
When I dichotomise it into 'children' and 'no children', there is no effect.

But if I keep all the levels, there is a significant association with having 3 children.

I'm not sure how to interpret it. Should I keep all the categories? Is this a real finding or a fluke? I know dichotomising is generally not a good idea but I thought it's warranted with such a variables where Yes and No are so clearcut.
For context, this is not my main research question, I'm looking at many potential risk factors and it's just one of them so I don't necessarily need to analyse it too deeply.
 A: If you test every number of children separately, you're running seven tests. According to Bonferroni, for making sure that you have a probability of smaller than 5% to find a significant result if in fact nothing is going on, you've got to run every single test at level 0.05/7. This is smaller than the p-value for 3 children. From this point of view nothing significant is going on in either situation. You may well keep all categories, but this doesn't give you a meaningful significance. (Obviously you could find that p-value suspicious and collect much more data to see whether it becomes even more significant, but it may not be worth the hassle.)
Added later: There was some discussion about whether it is wrong to treat the number of children as categorical, actually being a number, and what to do instead.
Generally I agree with the view that it makes sense to use the numerical meaning of the data. However this will usually involve assumptions about the functional form of the relationship. An important principle is that all available subject-matter knowledge should be used before actually analysing the data, as making modelling decisions based on the data will often produce selection bias effects and runs counter to theory behind some standard methods such as the significance tests for the coefficients.
So that first step before seeing the data should be to ask what kind of functional relationship could make sense here. The easiest assumed relationship would be linearity, but linearity may not be realistic, particularly because there may be a much bigger difference between 0 and any number of children than between two nonzero numbers of children (of course I can't tell without knowing the exact background). Also the relationship may be non-monotonic.
An additional problem is the question what can be identified from the data at what precision. Standard errors for 5, 6, 7 (maybe even 4) children suggest that there is not much data for these and whatever can be said will be very imprecise. In fact one could know this already from the plain numbers of observations falling into these categories (taking those into account will hardly bias later analyses as they don't imply information about the regression relationship).
This means that there may not be enough information to nail down confidently any relationship more complex (i.e., requiring more parameters) than a linear one, and making assumptions that require only a low number of parameters to be estimated is certainly desirable. This also means that treating the larger numbers of children as autonomous categories doesn't give useful information either. The standard errors of about 19 suggest that there is hardly any power to detect anything; for sure shown results cannot even exclude the possibility that there is a monotonic or even linear relationship (or none at all), even though the latter may not be realistic.
If relationships don't follow simple functional forms, in fact aggregation of categories can be a sensible choice; depending on the background comparing zero with existing children may be justifiable, and in general even something like "zero", "one or two", "more than two" can work better than either using all numbers as separate categories (particularly with very thin numbers on some categories) or assuming linearity or a more complex functional form. As said before, optimally such decisions should be made before seeing the data (or at least the regression relationship); however looking at the data may reveal a striking specific deviation from an initial assumption/decision, in which case model selection bias is probably less bad than sticking to an inappropriate initial decision at any cost.
From the numbers I currently see, I suspect however that clear evidence for any influence of this variable whatsoever cannot be found in the given data, and I'd be very skeptical if any of the ideas above applied at this time point would lead to a just about significant p-value, which in that case may well be explained by model selection bias.
Note also, as discussed elsewhere, that looking at p-values often isn't a very good way of doing variable selection.
A: This is a great example of why it is so difficult to 'hypothesize after the results are known' and why we should make analysis plans before we start, even for observational data.  Every analysis we try now will just reflect something we've already seen, and we could probably find an analysis to give whatever answer we want.
IMO we can't say whether or not having children affects your outcome based on this data. Certainly your dataset is not inconsistent with 'no effect' so this is probably how you should explain it as that's how we normally think about statistical significance.  Particularly if this also comes from a set of secondary outcomes that you are exploring.  We also can't rule out a small effect.
From a programming point of view for an 'honest' quantification of your results you might try using emmeans to get the base vs all other group contrasts, and use whatever p-value and confidence interval correction is recommended for this kind of comparison.  Or just report your initial model of 'number of kids' as a numeric, if this was supported by your theory and is what you tried initially.
Whether or not it makes sense to analyse the number of children in categories like this is up to you.  Social factors might make 3 kids qualitatively different from 2, Its down to your population and your theory.
Statistical arguments aside you could also consider the Bradford Hill criteria to check if you believe a result is real or meaningful.
Finally, if you don't need have an opinion about what this data means then you don't need to overthink it.  Just show your readers your model and your results and let them decide.  A graph like this might be instructive:

A: Why not run an ANOVA and see whether adding all the levels improves overall fit? If it does then you can worry about which level is driving it.
