I have about 30000 observations of a variable $Y$ for different categories of a treatment $X$. Some treatments have over 500 samples and it's very reasonable to take just these cases ($P(Y|X) \simeq freq(Y|X)$), other potential treatments have never been seen, and thus it is reasonable to apply all the data (or the mean over all seen categories, $P(Y) \simeq freq(\mathbb E[Y|X])$. What I'm wondering is how to address those categories that have very few samples (many have just 1).
Ideally I'd like to have a parameter that allows me to interpolate between the observed distribution for the entire sample and the distribution for the sample of a given treatment, which places more wight in the latter the more samples we have.
I need to interpolate the distributions (not just the means) because I haven't got a good model for the distributions of $X$ (they're certainly not Gaussian, Poisson or anything I can identify), and I need to keep track of confidence intervals.