# Are anxiety measure fixed or random factors in this scenario?

As a psychologist and not a statistician, I have always used ANOVAs to perform analyses on repeated-measures designs but have since learned you should instead use mixed linear modeling with these type of experiment to deal with the (pretty much inherent) sphericity violations that come with them. As such I'm trying to re-run all of my analyses appropriately using this new technique. As someone with a horrific math background, please bear with me as I try to garner some insight into how to correctly create a model because I have no guidance here but am reading as much as possible and trying really hard.

I have an experiment with the following set-up:

I have two different groups of subjects - TU and RU. This is a between-subjects factor.

Each subject (regardless of group) is exposed to 3 different stimuli - CS+, CS-, and CST. This is a within-subjects factor.

Each subject (regardless of group) is exposed to 2 different MRI scans - Temporal scan and Compound scan. This is a within-subjects factor. I don't know if this is important but: During each scan they see different physical shapes. Also during each scan the seem the same TYPES of stimuli; however, whereas the CS+ and CS- are essentially the same during each scan the CST is different between scans (i.e. it is associated with 100% shock during the temporal scan but only 50% shock in the compound scan).

During each stimulus presentation we are measuring the dependent variable at each of 12 timepoints - sec1, sec2, ..., sec12. This is a within-subjects factor.

We have collected 3 other variables we are hoping to control for:

1. Sex (M and F)
2. STAI-T anxiety scores
3. STAI-S anxiety scores

The dependent variable is rating where they rate how likely they are to be shocked at that point in the trial.

I have not collected any participants in the RU group as of yet so I am avoiding the groups variable at the moment.

I'm using R's lme4 to create my model so my first problem is figuring out what are fixed versus random factors in this scenario. So far I believe the following to be true. Stimuli, scans, and timepoints are all fixed factors. The stimulus manipulation is our main manipulation. We are also hoping to investigate the difference between the "same" stimuli during each scan (i.e. between the CST in the temporal scan & the CST in the compound scan, etc.) so scan is a fixed factor as well. While it might seem weird to have timepoints as a fixed factor, one of our hypotheses regards where in the trial the ratings differ between each stimulus so that's why I'm considering timepoints a fixed factor.

In terms of random factors - I'm almost positive subject is a random factor. It's the only random factor I'm basically sure of.

My confusion is mostly regarding whether to consider the remaining variables - specifically the STAI scores - fixed or random. I am using this book as a basis for my learning and am slightly confused. Essentially I DO want to know how sex, STAI-S, and STAI-T scores affect ratings but they were not the variable of interest nor were they manipulated. I BELIEVE all three should be considered random factors. According to the book linked above the variables might fit the criteria for fixed factors for the following reason: Our subjects are screened to not have anxiety disorders. The STAI is not a measure of clinical anxiety so, while subjects have the potential to score any value on the STAI tests, I'm ultimately not going to be able to generalize data to the entire population. According to this post here though, these seem to fit more with random effects since I would expect to get different values if I ran the experiment again and, while it would be interesting to see the effects of the scores on the ratings, the main point of including them in the model is to ACCOUNT for them, so perhaps they should be random?

Can anyone give insight on if I'm moving in the right direction with all of my variables? Ultimately I know I'll have questions about nested/crossed factors and what the ultimate model should be but this is my starting place.

I think it would help if you would distinguish between a *random grouping factor" and a "random effect".

In your case, subject is a random grouping factor - think of it as a container holding repeated values of your dependent variable collected over time. The subjects in your study are presumably representative of a larger universe of subjects to which you wish to generalize the findings of your study.

Now, because you have repeated values of the dependent variable available in each subject container, imagine that you can use those in conjunction with the corresponding values of relevant (time-varying) predictor variable(s) to fit a subject-specific model. As an example, if the predictor is time, the subject-specific model would relate the (shock) rating to time in order to ascertain how the rating changes over time for a subject.

For simplicity, let's say that the rating tends to increase over time and that you can estimate a subject-specific intercept and slope for each subject. If time is coded so that time = 0 for the first time point, then the subject-intercept represents the expected rating when time = 0 and the subject-specific slope represents the change in the expected in rating per unit of time.

You can formulate the subject-specific model by allowing the subject-intercept to be different across the subjects in your universe (not just the ones in the study) and also by allowing the subject-specific slopes to be different across the subjects in your universe. In other words, you can allow the mixed effects model to incoporate heterogeneity in the expected rating at time 0 across subjects in your target universe and also heterogeneity in the effect of time on the rating across the same subjects. (The mixed effects model is the collection of subject-specific models.)

If the effect of time on the rating is assumed to be different across subjects in your target universe, we say that the effect of time on the rating is random. If the effect of time is assumed to be the same across subjects in your target universe, we say that the effect of time on the rating is fixed. (A random effect of time is said to be a varying effect since it varies across subjects in the target universe. By that token, a fixed effect of time would be a non-varying effect across those subjects.)

If your STAI-T anxiety score is also measured repeatedly over time, then you could either assume it has a fixed effect on the shock rating (i.e., same for all subjects) or a random effect on the shock rating (i.e., different across subjects). Your data will provide support for one of these assumptions. Same considerations apply for your other anxiety score.

If a predictor variable is not measured over time (e.g., Sex), then its role in the model is to try and explain the heterogeneity you see either in the subject-specific effects of time-varying predictors or in the subject-specific intercept. In other words, can Sex be used to explain some of this heterogeneity? If you include the Sex variable by itself in your mixed effects model, say, then it will be used as a basis for explaining heterogeneity in subject-specific intercepts. If you include Sex as well as its interaction with a time-varying predictor, then Sex will be used as a basis for explaining heterogeneity in subject-specific effects of that time-varying predictor.

So it helps to think first about your ratings (measured at multiple time points) and then predictor variables which are also measured repeatedly at those time points. Then you can go from there.

• (+1) Great answer ! – Robert Long Feb 8 '19 at 15:50
• Thank you so much for your kind words, @RobertLong! 😊 – Isabella Ghement Feb 8 '19 at 15:53
• This is an amazing and clear answer. Absolutely better than anything I've read. I don't even think I need to ask any clarifying points - I can just thank you immensely for your effort and let you know I'll be using this to make decisions in the future. I really can't thank you enough. – chainhomelow Feb 11 '19 at 17:55
• @chainhomelow: Please ask clarifying points if you need to - there are always helpful people on this forum. Also, thank you for what is, hands down, the nicest feedback I received on this forum since I started answering questions. 🤗 – Isabella Ghement Feb 12 '19 at 3:40