# two-way mixed effects models

#### cg78ithaca

##### New Member
I am trying to run a mixed effect model defined as:

log(volume) = A + B*time + epsilon

and

A = A0 + A1*T + epsilonA
B = B0 + B1*T + epsilonB

The data is tumor volumes in two groups (T = 0 or T = 1) of mice, and each mouse's log(volume) increases linearly in time, but with slopes and intercepts varying from mouse to mouse (thus epsilonA describing inter-subject intercept variability and epsilonB inter-subject slope variability) and experimental measurement error epsilon. The question of interest is to test for any differences in the populations of slopes and intercepts between the T = 0 and T = 1 group, therefore to determine the A1 and B1 parameters and assess whether they are different from 0 e.g. by confidence interval testing.

If I want to fit the model for e.g. the T = 0 group, the stata command is:

mixed log_TV time || subj: time if T == 0

with the following output:

Performing EM optimization:

Iteration 0: log likelihood = 43.689057
Iteration 1: log likelihood = 43.689057

Computing standard errors:

Mixed-effects ML regression Number of obs = 93
Group variable: subj Number of groups = 11

Obs per group:
min = 5
avg = 8.5
max = 13

Wald chi2(1) = 135.49
Log likelihood = 43.689057 Prob > chi2 = 0.0000

------------------------------------------------------------------------------
log_TV | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
time | .0685592 .00589 11.64 0.000 .057015 .0801035
_cons | 1.710639 .0393407 43.48 0.000 1.633533 1.787745
------------------------------------------------------------------------------

------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
subj: Independent |
var(time) | .0003463 .0001667 .0001349 .0008895
var(_cons) | .0123727 .0072447 .0039269 .038983
-----------------------------+------------------------------------------------
var(Residual) | .0124918 .0020529 .0090519 .0172391
------------------------------------------------------------------------------
LR test vs. linear model: chi2(2) = 123.02 Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

Thus (since T = 0), A0 fits to 1.710639, B0 fits to .0685592, var(epsilonA) = .0123727, var(epsilonB) = .0003463, and var(epsilon) = .0124918.

I'm not sure how to include the T as an independent parameter in the model. It is not

mixed log_TV time i.T || subj: time

since that would fit the model to something like log(volume) = A + B*time + C*T + epsilon

Instead it is a two-level (at the level of the fixed-effects) model that I am looking to implement, and not sure if and how Stata can do it.

In terms of matrix notation, the model I am trying to fit is:

View attachment 6765

Cristian