I saw a couple of questions, very similar but unfortunately without any answer e.g.here and here. I aim to make it clear here with a dummy data hopefully, to receive some guidance
I would like to investigate the effect of a treatment on a group of patients. These patients have been measured by 16 measurements (ultrasound imaging) before receiving a drug and one year after. Therefore, we have around 32 measurements.
Here is a dummy data with 6 patients and three measurements. columns ending with "_0" indicate before treatment and "_end" for afterwords. Similar to other clinical studies the question is whether the treatment has significantly changed initial measurements.
ptid,group,a_0,b_0,c_0,a_end,b_end,c_end
1,0,29,18.75,22,18.75,29,37
2,0,37,34.72,37.82,34.72,37,39
3,0,39,21.22,21.01,21.22,39,25
4,1,25,22.88,12.37,22.88,25,24
5,1,24,15,16,15,24,30
6,1,30,20,10,20,30,12
and my code so far is as following
tt = read.csv("~/Downloads/_tmp.csv")
rownames(tt) =tt$PtID
experiment_start = tt %>% select("ptid", "group", ends_with("_0"))
experiment_start.melt = melt(experiment_start, id.vars = c("ptid", "group"))
experiment_start.melt$Time = rep("start", nrow(experiment_start))
experiment_end = tt %>% select("ptid", "group", ends_with("_end"))
experiment_end.melt = melt(experiment_end, id.vars = c("ptid", "group"))
experiment_end.melt$Time = rep("end", nrow(experiment_end))
df.tot = rbind(experiment_start.melt, experiment_end.melt)
colnames(df.tot)[2] = "Treatment"
my.measurements = gsub("_0", "", df.tot$variable)
my.measurements = gsub("_end", "", my.measurements)
df.tot$measurement = my.measurements
so now the data looks like
res.aov = aov(value ~ Treatment, data = df.tot)
Basically, I am not sure what should be the anova formula. I know Time
is a factor, but is it interacting (Treatment * Time) with the treatment ? or is it just an addition factor (Treatment + time). I appreciate if you guide me on this. In addition how the formula differs if I use a linear mixed model to perform this test ? To add random effect, e.g. gender or age should I include it as | age + gender
** UPDATE I
These 16 measurements are spatial information of echocardiogram wave. Basically the wave shows a beating heart and motion of the heart during 1 heart cycle/beat. We quantify them into 16 points (beginning some specific peaks and etc).
Reason why we want to examine all the parameters is that we are not sure whether medicine is going to have influence on the passive (start of the curve ), peak or plateau of the curve.
Main question is how to conduct a test to investigate whether the echocardiogram of patients have significantly changed after taking the medicine.
** UPDATE II
The measurements show different times during one heart beat. However: one of the measurements display strain during one heart beat in septum, while the other display global measures from the whole chamber during one heart beat. LS has unit %: how much % the heart muscle moves, LSR has 1/s: how fast the heart muscle moves, D (displacement) has unit mm: how long (in mm) heart muscle moves.
df.tot$Time=factor(df.tot$Time,levels=c("start","end")) ; ggplot(df.tot,aes(x=factor(Treatment),y=value,fill=Time))+facet_wrap(~measurement) + geom_point(position=position_jitterdodge()) + geom_boxplot(alpha=0.3)
$\endgroup$