I’m returning with a problem not dissimilar to this one, but with a better idea of what is needed!
We have measured the heart rate of embryos before and after a one-hour exposure to a drug at different pH levels. Different levels of pH were broadly established by adding different concentrations of sodium bicarbonate to the incubation medium, but sample pH was also measured at the same time as heart rate.
So, I have a repeated-measures dependent variable of interest, hr; three independent factor variables, conc (concentration of drug), sb (concentration of sodium bicarbonate), and time; and a repeated-measures dependent continuous covariate, ph. Because both conc and sb can take decimal values, I have multiplied them by 10 so that they can be used as factor variables.
For simplicity, let’s look at the control group, focussing solely on the interaction between sb and time. My model looks like this (in this instance, a sodium bicarbonate concentration of 17.9mM is the reference):
or, omitting the covariate,
Running the latter gives me the following:
As you can see, there is a substantial reduction in heart rate when the concentration of sodium bicarbonate is 0mM or 1.5mM, compared to the reference.
If I run the covariate model, there is a major problem:
While the adjusted margins for the reference group are similar to the unadjusted ones, those for the other two groups are way out, particularly at time 0!
It seems that the covariate is correcting for pH differences between pH blocks, but that is already accounted for in the model by sb. What I really wanted to do with ph is to control for any influence on the change in pH upon hr within each.
I cannot add an interaction with ph because it's collinear with sb. Any thoughts on how this could be remedied would be appreciated!
We have measured the heart rate of embryos before and after a one-hour exposure to a drug at different pH levels. Different levels of pH were broadly established by adding different concentrations of sodium bicarbonate to the incubation medium, but sample pH was also measured at the same time as heart rate.
So, I have a repeated-measures dependent variable of interest, hr; three independent factor variables, conc (concentration of drug), sb (concentration of sodium bicarbonate), and time; and a repeated-measures dependent continuous covariate, ph. Because both conc and sb can take decimal values, I have multiplied them by 10 so that they can be used as factor variables.
For simplicity, let’s look at the control group, focussing solely on the interaction between sb and time. My model looks like this (in this instance, a sodium bicarbonate concentration of 17.9mM is the reference):
Code:
mixed hr ib179.sb10##time c.ph if conc==0
Code:
mixed hr ib179.sb10##time if conc==0
Code:
. mixed hr ib179.sb10##time if conc==0 || id: Performing EM optimization: Performing gradient-based optimization: Iteration 0: log likelihood = -436.7289 Iteration 1: log likelihood = -436.72557 Iteration 2: log likelihood = -436.72557 Computing standard errors: Mixed-effects ML regression Number of obs = 106 Group variable: id Number of groups = 53 Obs per group: min = 2 avg = 2.0 max = 2 Wald chi2(5) = 78.34 Log likelihood = -436.72557 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ hr | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- sb10 | 0 | -4.996337 6.29288 -0.79 0.427 -17.33016 7.337482 15 | -.4249084 6.29288 -0.07 0.946 -12.75873 11.90891 | 1.time | -3.179487 2.842858 -1.12 0.263 -8.751387 2.392413 | sb10#time | 0 1 | -28.82051 7.28761 -3.95 0.000 -43.10397 -14.53706 15 1 | -34.5348 7.28761 -4.74 0.000 -48.81825 -20.25134 | _cons | 187.2821 2.45482 76.29 0.000 182.4707 192.0934 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ id: Identity | var(_cons) | 77.42346 33.98905 32.74865 183.0424 -----------------------------+------------------------------------------------ var(Residual) | 157.596 30.61415 107.6944 230.6201 ------------------------------------------------------------------------------ LR test vs. linear model: chibar2(01) = 6.09 Prob >= chibar2 = 0.0068 . margins sb10#time Adjusted predictions Number of obs = 106 Expression : Linear prediction, fixed portion, predict() ------------------------------------------------------------------------------ | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- sb10#time | 0 0 | 182.2857 5.794325 31.46 0.000 170.929 193.6424 0 1 | 150.2857 5.794325 25.94 0.000 138.929 161.6424 15 0 | 186.8571 5.794325 32.25 0.000 175.5005 198.2138 15 1 | 149.1429 5.794325 25.74 0.000 137.7862 160.4995 179 0 | 187.2821 2.45482 76.29 0.000 182.4707 192.0934 179 1 | 184.1026 2.45482 75.00 0.000 179.2912 188.9139 ------------------------------------------------------------------------------
If I run the covariate model, there is a major problem:
Code:
. mixed hr ib179.sb10##time c.ph if conc==0 || id: Performing EM optimization: Performing gradient-based optimization: Iteration 0: log likelihood = -435.33309 Iteration 1: log likelihood = -435.33077 Iteration 2: log likelihood = -435.33077 Computing standard errors: Mixed-effects ML regression Number of obs = 106 Group variable: id Number of groups = 53 Obs per group: min = 2 avg = 2.0 max = 2 Wald chi2(6) = 84.12 Log likelihood = -435.33077 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ hr | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- sb10 | 0 | 54.66829 35.83739 1.53 0.127 -15.57171 124.9083 15 | 37.3623 23.2042 1.61 0.107 -8.117095 82.84169 | 1.time | -4.075213 2.822213 -1.44 0.149 -9.606648 1.456223 | sb10#time | 0 1 | -36.44387 8.415938 -4.33 0.000 -52.93881 -19.94894 15 1 | -37.57096 7.329471 -5.13 0.000 -51.93646 -23.20546 | ph | 35.28616 20.87117 1.69 0.091 -5.620595 76.19291 _cons | -70.74118 152.6358 -0.46 0.643 -369.9019 228.4196 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ id: Identity | var(_cons) | 80.96055 33.8667 35.66206 183.7979 -----------------------------+------------------------------------------------ var(Residual) | 149.8417 29.23925 102.2196 219.65 ------------------------------------------------------------------------------ LR test vs. linear model: chibar2(01) = 6.85 Prob >= chibar2 = 0.0044 . margins sb10#time Predictive margins Number of obs = 106 Expression : Linear prediction, fixed portion, predict() ------------------------------------------------------------------------------ | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- sb10#time | 0 0 | 230.2311 28.93441 7.96 0.000 173.5207 286.9415 0 1 | 189.712 24.01656 7.90 0.000 142.6405 236.7836 15 0 | 212.9251 16.45329 12.94 0.000 180.6773 245.173 15 1 | 171.279 14.29693 11.98 0.000 143.2575 199.3004 179 0 | 175.5628 7.346201 23.90 0.000 161.1646 189.9611 179 1 | 171.4876 7.848076 21.85 0.000 156.1057 186.8696 ------------------------------------------------------------------------------
It seems that the covariate is correcting for pH differences between pH blocks, but that is already accounted for in the model by sb. What I really wanted to do with ph is to control for any influence on the change in pH upon hr within each.
I cannot add an interaction with ph because it's collinear with sb. Any thoughts on how this could be remedied would be appreciated!
Comment