How do you adjust the residuals of a linear mixed model in R?

Hi all,

I’m having issues collecting the data I need for a power calculation which will be performed by someone else. My stats and coding abilities are minimal so could really use some help!

Experimental set up: male and female subjects (=sex, M/F) from 2 different groups (=genotype, WT/KO) . I need to know how many subjects and how many samples/subject I need to analyse. I already analysed 2 subjects for each condition, 20 samples/subject, which provides the dataset I'm using for the power calculation.

I’m currently using a linear mixed model analysis, such as:

logdendritemeandiameter.lm <- lmer(log(Dendrite_Mean_Diameter) ~ sex + genotype + (1|subject), data = dendrite)

Problem: I have been requested to “save the residuals adjusted for sex, standardise them and send mean and SD in KO group and in the WT group separately." For various reason, this it the best explanation of what I have to do I can get.

Question: I have standardised my residual using:

stres = residuals(logdendritemeandiameter.lm, type = "pearson")

However, I cannot understand how to adjust the residuals for sex and how to then o btain mean and SD for each of the genotypes separately . Any suggestion?

Thank you!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.