# For linear mixed model, how do I choose the random effects?

The model follows the form of y = XB + Zϒ + ε, where y is the matrix of outcome variable, X is the matrix of predictor variables, Z is the design matrix, ϒ is the vector of random effects, and ε is the vector of residuals.

Now, we have to consider for the random effects. Consider to make the time points as the random effects. The reason is that we expect that the "outcome" within each time point may be correlated due to some effects such as treatment.

Is this the right way of thinking for choosing random effects?

• you have drawn your subjects, items or cases randomly from a bigger population. Say you had 40 right-handed participants age 18-20 in your experiment, then you chose those people "randomly" from all the right-handed people age 18-20 that you could have chosen. Then your random effect would be participant: You look at your treatment effect by subject (as you expect there to be inter-individual differences you're not actually interested in but want to account for). Say you would have them look at pictures, the same would hold: You second random effect would (probably) be picture b/c you chose the pics "randomly" from a collection of many pictures and you would expect there to be some variance in you data merely due to the inter-individual differences within the pictures. Basically, you don't want the inter-individual differences to interfere with the effect you're actually interested in.
• when your random effect has more levels in reality than actually occur in your data. Say in the experiment above you've noticed some sit closer to the screen than others and you measure the distance each time. Say among the 40 people you have a few sitting only 25cm from the screen, a few 60cm from it, and the rest 30-58cm from it. But no one sits 25.1-29cm, 58.1-59.9cm or 28,38,40,41cm from the screen. Then you don't have all possible levels of the effect distance from screen in your data while in reality, all your missing levels exist. When you have all levels, include distance as a fixed effect.