pitakakariki / simr

Power Analysis of Generalised Linear Mixed Models by Simulation
69 stars 19 forks source link

Assumptions about effects for Power Analysis from scratch #180

Open maxjantz opened 4 years ago

maxjantz commented 4 years ago

Hello,

please excuse my low-level questions but I am struggling to find a correct solution for some weeks now. Maybe I can get some help here.

I try to calculate a priori power for a longitudinal multilevel study. I don't have pilot data for now but I know how my data will look like after assessing it.

I will have an dependent variable that contains values (mean scores on a scale) ranging from 1 to 6 (e.g., decimal number 3.5 for one measurement). I will collect these data at baseline and at 10 different time points after an intervention. So, I will also have two groups (treatment/control) and I am interested in gender differences as well.

Assuming I will have equally sized groups in the end, my covariate data should look like this somehow:

N = 100 label_gender <- c("male","female") label_cond <- c("treat","con","con","treat") timePoints <- 11 subject <- rep(1:N, each=timePoints) time <- rep(0:(timePoints-1), N) gender <- rep(label_gender,2,each=timePoints) gender <- as.factor(gender) cond <- rep(label_cond,1,each=timePoints) cond <- as.factor(cond) df <- data.frame (subject, time, cond, gender)

My hypotheses are:

H1: Subjects in the treatment group will have an increased value in the dependent variable in contrast to subjects in the control group at each subsequent point of measurement. H2: The treatment effect over time is stronger for male than for female.

From literature I know there is an interaction effect of gender and condition on change in DV over time (they used a difference value here) with standardized Beta = 0.49 (analysis was multiple regression in that case).

I tried to use the makeLmer command using the following parameters but I am not sure about the specification of effects.

Parameters for fixed effects (one intercept and slopes for time, condtreat, groupmale, time:condtreat, time:groupmale, condtreat:groupmale, time:condtreat:groupmale)

fixed <- c(3,0.5,0.7,0.5,1,0.1,1,2)

Parameters for random effects (intercepts and slopes)

rand <- matrix(c(0.1,0,0,0.05),2)

Residual Variance

res <- 1

create model

model <- makeLmer(y ~ time*cond*gender + (time|subject), fixef=fixed,VarCorr=rand, sigma=res, data=IV)

The code works and I am able to run powerSimulations afterwards but I am really unsure about the effect parameters. As my DV is coded with values from 1 to 6, I assume that for example a slope estimate of say '2' for the overall interaction effect (time:condtreat:gendermale) means that there will be a difference in increase of '2' in DV for the effect time:condtreat for male over female.

First, am I right with these assumptions? and Second, if I want to get Power for a rather small effect would it make sense to set this estimate to 0.1 for example?

I am really sorry for bothering you with these stupid questions but I am not really experienced in this. Thanks a lot in advance for your help!

pitakakariki commented 4 years ago

This all looks fine to me.

I can't really answer your second question - it's subject specific what counts as a "small" effect. 0.1 does look very small on a 1-6 scale though.