DeclareDesign Community

Repeated measurement with continous treatment

I am wondering how one could simulate a repeated measurement design with a continous treatment in each group without crossover of treatments?

Imagine you want to test a specific behavioural intervention that increases waste seperation at the workplace (e.g. better labels). You test your treatment against a placebo treatment. You only have a fixed number of subjects (e.g. one recycling bins at each floot), but you assume that treatment effects increase over time each week and you potentially have an unlimited amount of time and can measure every week. How could one set up a simulation to find out the amount of time needed to have a power of at least 0.8?

I assume one knows the following:

N = 20
b = .5                     #correlation between each week
c = .1                     #change over time in control group
d = .002                   #decrease of effectiveness of treatment each week
ATE_time = tau + .3 -  t*d #effect of treatment per week, decreasing by d for each week t

Here is a quick demo of generating multi-level data in fabricatr in long format, which at least gets data in the right shape for later analysis with lme4:

N = 20
T = 5                       # Number of time points
b = .5                     #correlation between each week
c = .1                     #change over time in control group
d = .002                   #decrease of effectiveness of treatment each week
tau = 7

require(DeclareDesign)
        
pop <- declare_population(subject = add_level(N=N),
                         time = add_level(T, t=1:T))

estimand <- declare_estimand(ATE_time = mean(tau + .3 -  t*d))

pots <- declare_potential_outcomes(Y~Z*(tau + .3-t*d) + rnorm(length(t)))

pop + estimand + pots

Long format will also make it easier if you have time-dependent assignment or sampling steps, as in adaptive or multistage designs.

If you had to do wide format (one column for each time point), there would be quite a bit more repetitive code, one per time point. Some panel data analyses expect data in that format, though.

In your code, you had indicated wanting a correlation between each week - depending on what you meant exactly with that, you can swap out the rnorm in the potential outcomes with a multivariate normal or some other distribution. It would be up to you to specify the autocorrelation (are subjects independent, or are the off-block-diagonals also filled in? with what?). Alternatively, you could solve for tau such that Y has that correlation, since you still have a free variable or two to play with. I generally find it more straightforward to build designs in terms of latent variables (inputs) instead of correlations (outputs) - correlations can be fiddly and nonlinear, especially if both variables are being simulated and changing at the same time.

1 Like