Comparing two means, finding critical value This has probably been asked before, but I couldn't find anything.
I need to compare continuous variable in two groups: I can calculate mean, s.d., etc. I can do t-test.
If t-test is statistically significant, how can I find the exact value, which separates one group from another? Like if x>100 we expect it to be in group A. Should I use 95% CI for this??
Basically I have a task like this: patients in group A have mean age of, say 35, with sd=5. Patients in group B have mean age of 50 with sd=6. T-test shows singificant difference between groups. Is there a way to find some age X, that we can use to state that patients above that age are more likely to belong to group B. Sorry, I must be terrible at explaining.
 A: This is a classification problem. If you want to find single value that marks the threshold that let's you to divide your data into two groups, then the most standard approach to problem as yours is to use decision tree. Decision tree algorithm splits your data into branches given the predictors such that the resulting split leads to most accurate classification.
Blow you can see usage of R's rpart function on some made-up data. It does exactly what you want: finds threshold value that let's you to classify the data into two groups. Of course, in more complicated cases the tree could have more levels and you'd need to prune it.
library(rpart)
set.seed(123)

n <- 50
x <- rnorm(n, 1)
y <- rnorm(n, 3)

dat <- data.frame(
  predictor = c(x,y),
  group = factor(rep(letters[1:2], each = 50))
)

(fit <- rpart(group ~ predictor, data = dat, method = "class")))
## n= 100 
## 
## node), split, n, loss, yval, (yprob)
##       * denotes terminal node
## 
## 1) root 100 50 1 (0.50000000 0.50000000)  
##   2) predictor< 1.911667 46  3 a (0.93478261 0.06521739) *
##   3) predictor>=1.911667 54  7 b (0.12962963 0.87037037) *

On the plot below you can see distributions of both variables with marked decision threshold.

Notice that this is something different then hypothesis testing. In case of using hypothesis test such as $t$-test you ask yourself if means of both groups significantly differ. In case of classification you do not care if there is any difference at all, just look for the best model that minimizes some loss function (even though is can be a really poor model in some cases).
A: If your sample sizes are about equal, then one possible solution is simply to find the value(s) that separate your two groups such that there is the least amount of overlap in your existing data, and use this as your threshold.  For example:

