# Is it reasonable to calculate AIC of a subset of the data set which was used to fit the model?

There is a factor variable called "Treatment" in my data set. This factor consists of two levels, "C" and "H". I want to test whether there is there any significant difference between two levels. I can fit this model through lme(). I cannot include "Treatment" as a covariate in my model. My professor gave me the following suggestion:

"first find the optimal parameters for each treatment group (C and H) and also find the optimal parameters for the joint dataset (with C & H combined). Then you could use a likelihood test based on the AIC to show that fitting either C or H using the jointly estimated parameters would achieve a significantly worse result than by using the parameters optimized for the individual group."

I cannot understand the last sentence. Is it required for me to calculate the AIC for either C or H through the model fitted for the joint data set? If yes, how would I do that? Function AIC() could only gives the AIC for the data set used to fit model. I tried $AIC = n \cdot \ln(\frac{RSS}{n})+2K$ and $AIC = n + n \cdot \log(2\pi) + n \cdot \log(\frac{RSS}{n}) + 2k$, but neither of this gives me the same value to AIC(lme()). If not, how should I understand this?