# Is there a more efficient way to partition my data for use in lme4?

I'm currently using lme4 to fit the following model:

Model = lmer(CA ~ P + T + S + (1 | Study), Data)


P and T refer to pressure and temperature, and there is an a priori reason to expect a different relationship at low pressure and temperature compared to high pressure and temperature. So I've partitioned my data into two, one for supercritical CO2 conditions (P > 7.37 and T > 31.1) and one for everything else. Which means having two models...

ModelSub = lmer(CA ~ P + T + S + (1 | Study), DataSub)
ModelSuper = lmer(CA ~ P + T + S + (1 | Study), DataSuper)


I'm wondering, though, if there is a way to have a single model but include the 'phase' category somehow (Sub versus Supercritical) that doesn't introduce problems, and even if a single model would make it more difficult to interpret the results (at the model the results are easy to interpret because the estimates for T and S are very close across both models)?

Neither of these yielded what I expected...

ModelCombined = lmer(CA ~ P*Phase + T + S + (1|Study),Data)
ModelCombined = lmer(CA ~ P:Phase + T + S + (1|Study),Data)


In the second version (P:Phase) the T and S estimates were okay but the P:Phase estimates were the same for both categories whereas there is a marked difference when separate models are made...

• I'm a bit confused about your setup. Why would the sets $\left\{ P < 7.37, T < 31.1\right\}$ and $\left\{ P \geq 7.37, T \geq 31.1\right\}$ partition your data into two? What about $\left\{ P \geq 7.37, T < 31.1\right\}$, etc. Feb 24, 2015 at 8:20
• Sorry, you're correct. I've updated the original post. The partitioning is {P≥7.37,T≥31.1} and everything else - Data$Phase <- factor(ifelse((Data$P>7.37) & (Data\$T > 31), "Supercritical" , "Subcritical")) Feb 24, 2015 at 9:09
• could you provide some example data? I don't see why your last model would necessarily give the same result for both phases. In short, you can include the phase variable in all kinds of ways, are any of the warranted based on subject knowledge?
– swmo
Feb 24, 2015 at 10:19

ModelCombined = lmer(CA ~ P + T + P:T + S + (1|Study),Data)