# How to test for normality on paired samples between two treatments when the number of observations per treatment is unequal?

I have mice which need to poke a device to receive food across a one hour period. The device records the number of pokes and poke_time which is the duration that the mouse remained in the poke hole. This is recorded for each individual poke. I administered two different treatments to the same mouse on different days so my sample is paired. I want to see whether there is a difference in poke_time between the two treatments administered. However, because poke_time is dependent on whether the mouse poked, the number of recordings of poke_time across the one hour varies between each treatment.

I am not sure how i will go ahead with conducting a normality test for poke_time. If I use a Shapiro-Wilk test, I can't calculate the difference between treatments recorded across the one hour as the sample size is unequal between treatment A and B.

For example, treatment A has 235 pokes, each poke having a poke duration, while treatment B has 195 pokes, each poke having its own poke duration recorded.

• Are there a lot of 0s in your dataset, like 0 pokes and or/ 0 time spent in the hole ? I also did not understand the difference between A and B, both have a number and duration of poke right ? Sep 27, 2023 at 17:34
• poke_time has "na" values whenever no pokes are recorded. The entire dataset records every second for 60 minutes, so there are a total of 3600 observations. if no poke was made in say the 6th second, poke_time at this time point would have "na". Poke_time only has a value recorded if a poke has been made (e.g., poke 1 had a poke_time of 0.12 seconds). If i change poke_time from "na" to 0, then it may affect the mean. Sep 27, 2023 at 22:54
• But are there for example mice which never poked ? Like you would have 0 pokes per hour -> 0 seconds spent poking ? Sep 28, 2023 at 11:31
• Yes, so if there are no pokes, pokes would be 0, but poke_time would have a "na" value since no pokes were made Sep 29, 2023 at 1:47
• Then I would keep it like this, and if there are a lot of mice which never poked I would first analyze proportion of mice which poked according to the treatment. Oct 1, 2023 at 16:50

The number of pokes in 1 hour is count data, therefore I would analyze it with a GLM for a distribution of the Poisson family. You have 2 measurements on the same mouse, therefore mouse identity should be a random factor. You would have to run a GLMer. I would expect the amount of time spent in the poke hole to also follow some kind of Poisson distribution. Your model should look roughly like number of pokes~treatment +(1|mouseID) time spent in the hole~treatment +(1|mouseID)

I would personally be interested in knowing whether the relationship between number of pokes and time spent poking changes according to the treatment, i.e. whether there is an interaction between poke duration and treatment on the number of pokes. If in one treatment let's say mice poke more often but less long, it could mean there is a trade-off between the 2 variables. In the other treatment it might be the opposite, mice poke often and longer. Or it might be that there is no relationship between both. But this depends whether or not you have the sample size to detect the interaction. Then it would look like number of pokes~time*treatment+(1|mouse)

• Thank you, i did this formula "lmer(poke_time ~ treatment + (1|ID))", a random effects model. Maybe a GLM or GLMM would be a better model instead? Sep 29, 2023 at 1:54
• For count data I think it would be yes. Oct 1, 2023 at 16:47

There is no reason to expect normality. Think about using the rank difference test or its regression model generalization described here.

You have to acccount for a poke being a response variable just as poke duration is a response variable. Don't condition on a response variable by either using it as a covariate or conditioning on a poke. See if defining poke duration = 0 when pokes don't occur makes sense.

Note that ordinal model generalizations for rank pre-post tests allow imbalance, if imbalance still exists after paying attention to proper construction of a response variable. But I guess for a secondary analysis you can delve more deeply into the distribution of poke time given that a poke occurs, just not so much for comparing pre with post.

• Thank you, i went with a random effects model as my sample is paired with an uneven sample size per treatment, and not assuming normality Sep 28, 2023 at 5:03