Addendum: My concern about that particular way of specifying the model is that I'm pretty sure that the mean of the replicate effect will be zero across all subjects, but it is unclear whether the per-patient mean of the replicate effect will be zero (which I think it should be for my case).
How to specify this mixed effects model?
2 views (last 30 days)
Show older comments
I need to specify a model (for input into fitlme). My experimental design is very similar to the indomethacin example in the documentation for nlmefit, but with a slight extension. I'm not sure how to specify the model.
In that example, there are 6 test subjects, who represent a sample from the broader population. It is therefore appropriate to use a random effect to capture the subject-specific effect (as the example shows).
If it were appropriate to use fitlme for the indomethacin example, the model could be specified in Wilkinson notation as
'concentration ~ 1 + time + (time|subject)'
The model has a fixed effect for time, and (possibly correlated) random effects for the intercept and slope for each subject.
My extension of this example is that for each subject, I am going to take their blood sample and have their blood level tested two or more times by the lab at each time point. (This is known as using "technical replicates", to account for variability in the chemical test itself.)
How would I specify that model? My best guess is to define a categorical replicate variable, which has a unique value for each blood sample. The indomethacin example has 11 time points and 6 subjects, for a total of 66 observations. If I now want 2 technical replicates, then I would have 132 observations, where I would define
replicate = categorical((1:132)');
and the model would be specified as
'concentration ~ 1 + time + (time|subject) + (time|subject:replicate)'
Does that seem right?
Accepted Answer
Gautam Pendse
on 6 Feb 2018
I am guessing the data looks something like this:
>> tbl = table();
tbl.Time = repmat(repmat((1:5)',2,1),2,1);
tbl.Subj = categorical([ones(10,1);2*ones(10,1)]);
tbl.Replicate = categorical(repmat([ones(5,1);2*ones(5,1)],2,1));
>> tbl
tbl =
20×3 table
Time Subj Replicate
____ ____ _________
1 1 1
2 1 1
3 1 1
4 1 1
5 1 1
1 1 2
2 1 2
3 1 2
4 1 2
5 1 2
1 2 1
2 2 1
3 2 1
4 2 1
5 2 1
1 2 2
2 2 2
3 2 2
4 2 2
5 2 2
The coefficients vary not only for each subject but also for each subject and replicate combination. And so one possible model is:
'concentration ~ 1 + time + (time|subject) + (time|subject:replicate)'
If replicates are given unique IDs then (time|subject:replicate) would be the same as (time|replicate). In other words, coefficients vary for each observation. I don’t know which model is more appropriate. If (time|replicate) with unique replicate IDs is appropriate then for an isotropic covariance pattern we could use (-1 + time|replicate) since the residual error term can be thought of as (1 | replicate).
Hope this helps,
Gautam
More Answers (0)
See Also
Categories
Find more on Analysis of Variance and Covariance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!