0

I am working on a dataset with longitudinal data and my goal is to check the normality of the variable value. Below I have put an example of the dataset I am working on. I would need a method in R to test the normality of value taking into account longitudinality. In this case of the fact that I have the measurement repeated several times for the same subject and that within each subject I have the measurement repeated several times within the same time of the year. Can you help me? Below is an example of my dataset.

Subject | Season | date | value | Treatment

1        autumn             01-09    232       Medicine
1        autumn             02-09    213       Medicine
1        autumn             05-09    228       Medicine
1        winter             06-12    343       Medicine
1        winter             09-01    377       Medicine
1        summer             27-06    301       Medicine
2        winter             16-12    333       Placebo
2        winter             25-01    384       Placebo
2        spring             12-06    301       Placebo
Bibi
  • 19
  • 4
  • Normality is a property of a distribution of values in which the ordering (e.g. by time) does not matter. What is your purpose of the test? Do you want to apply a linear model on it? If yes, the residuals of the model needs to be normally distributed, not the input value itself. – danlooo Sep 28 '21 at 14:21
  • 1
    Voting to migrate this to [stats.se] as it is about how to do analysis/statistics, not about programming. – r2evans Sep 28 '21 at 14:24
  • I would like to build a repeated measure model (maybe LME or anova mixed, do you have any suggestion?), but still the normality test for residuals is not immediate since we should take into account the correlation within "subject" and within "moment of the year". Danloo, maybe do you know how to procede? – Bibi Sep 28 '21 at 14:31
  • You should check the residuals of the mixed effects model for (approximate) normality. Don't bother with normality tests, check diagnostic plots instead. If you model the random effects correctly, their effect is removed from the residuals. – Roland Sep 28 '21 at 14:39
  • I built this model: fm1 <- lmer(VALUE ~ TREATMENT+ DATE + (1| SUBJECT) + (1|SEASON) , data). I am not sure about this model. And two problems: -1) resid(fm1) gives 1 residual for each subject without accounting for longitudinality; -2)the normality on that residuals is totally rejected. Do you have any suggestion on a correct model to implement and the test of normality on its residuals? – Bibi Sep 28 '21 at 15:17

0 Answers0