I am new to Matlab and would like to fit a linear mixed effects model to some biological field data.
I have four predictors in (body_weight, avg_temp, sex, latitude, location). If my understanding is correct, sex (male/female) and location (any of 9 different locations) are grouping variables (latitude and avg_temp will vary according to location).
I have one response variable (wing_area).
My predictors and response are contained in a variable called ds (of the table class).
I have been instructed to use body_weight, avg_temp, sex and latitude as fixed effects. Location is my only random effect.
The code I am using so far is:
lme = fitlme(ds, 'wing_area ~ body_weight + avg_temp + sex + latitude + (1|location)');
1) Does this syntax appropriately describe the model I am trying to develop?
2) Does it make sense that I am using avg_temp and latitude as fixed effects when they are dependent on location?
3) If so, do I need to somehow define these two fixed effects to be part of the grouping variable location? (I understand how to do this for random effects, i.e. ...(random_effect | group variable) but I'm not sure how to do this for fixed effects)
Thank you so much for any help you might be able to provide!