0
$\begingroup$

Let's say I've got 3 scaled quantitative features, and 1 target categorical feature. Each quantitative feature is independent from each other. If I use glmmTMB to try and fit a model for this I could do something like this:

myModel<-glmmTMB(TargetFeature~FeatureA + FeatureB + FeatureC)

But if these features are from a collection of different experimental participants, recorded during different experiments should they be included also as random variables in the model definition?

something like :

myModel2<-glmmTMB(TargetFeature~FeatureA + FeatureB + FeatureC 
              + (1 | Participant) + (1 | ExperimentGroup/Experiment))

The data would look like this:

data[1:5,c('Participant','ExperimentGroup', 'Experiment', 'FeatureA', 'FeatureB','FeatureC')]
  Participant ExperimentGroup Experiment FeatureA     FeatureB        FeatureC
1      AC-001             E01      E01-A -0.5940626 -0.10808170       0.5198040
2      AC-001             E01      E01-A -0.5940626 -0.18172495       0.5198040
3      AC-001             E01      E01-A -0.5940626 -0.18172495       0.5198040
4      AC-001             E01      E01-A -0.5940626  0.21481427       0.5099361
5      AC-001             E01      E01-A -0.5940626  0.09152672       0.5090794

I'm having trouble understanding what would be necessary to model this, taking into account whether or not I'd need to use * or + for the second set of feature terms. (or even if I'm writing the model correctly at all) Any advice would be greatly appreciated!

$\endgroup$

1 Answer 1

1
$\begingroup$

Let's assume a simpler setting, where the end part of your model would look like (1|Participant) + (1|Experiment). That would be consistent with the fact that Participant and Experiment are fully/partially crossed so that every participant participated in every experiment/some of the experiments.

If the end part of your model would look like (1|Experiment/Participant), that would be consistent with the fact that you had multiple experiments, each with different participants.

In either case, the experiments you conducted would represent a (representative) subset of all the possible experiments you could have conducted and the subjects included in each experiment would represent a (representative) subset of all the subjects you could have included in the experiment.

How you write the model therefore has to reflect whether (i) Participant and Experiment are crossed (either fully or partially) or (ii) Participant is nested in Experiment.

The model you end up writing will help you learn something about a typical subject in a typical experiment.

$\endgroup$
4
  • $\begingroup$ Thanks very much Isabella, that clears it up for me! The participants were consistent across the set of experiments. So I'll rewrite the model like so: myModel3<-glmmTMB(TargetFeature~FeatureA + FeatureB + FeatureC + (1 | Participant) + (1 | ExperimentGroup) + (1 | Experiment)) $\endgroup$
    – Rob
    Commented Apr 5, 2018 at 19:13
  • $\begingroup$ Do you mean the participants were the same across experiments? What about the ExperimentGroup? Does it include only a subset of the groups you are interested? $\endgroup$ Commented Apr 5, 2018 at 19:40
  • $\begingroup$ although one quick question : in my example of 3 terms - it'd be correct to say that the same set of participants took part in all or some experiments or experimental groups. But it wouldn't be correct to say the set of experiments are fully crossed then with the experimental group. E01-A will only be related to ExperimentGroup E01, just as E06-E would only be related to ExperimentGroup E06 . Which would mean ` myModel3<-glmmTMB(TargetFeature~FeatureA + FeatureB + FeatureC + (1 | Participant) + (1 | ExperimentGroup) + (1 | Experiment) + (1 | ExperimentGroup/Experiment) )` ? $\endgroup$
    – Rob
    Commented Apr 5, 2018 at 19:51
  • $\begingroup$ The participants are the same across experiments - ExperimentGroup is just a label I'm giving to a set of experiments. So it would be true to say that they the same set of participants completed some or all experimentGroups just as it'd be true to say the participants completed some or all experiments $\endgroup$
    – Rob
    Commented Apr 5, 2018 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.