1
$\begingroup$

I have a dataset with 50 items divided in two groups: placebo (P) and diet (D). Each group has 25 items. Items were weighted once at two different times: at t0 (before treatment) and t1 (after treatment). I would like to test if the diet resulted in higher weight loss for items in group D compared to those in group P.

I think it's better not to use a t-test comparing the weight in t1 for D and P because I wouldn't take into account differences between the two groups which aren't due to the treatment.

Which test would you suggest?

Additionally, could you suggest some code lines to get the test done in R?

$\endgroup$

1 Answer 1

1
+50
$\begingroup$

You've got a classic parallel-group design with within-subject baseline. There are several valid solutions to your problem, the two easiest:

1.) Test the difference of change:

Subtract t1 and t0 within cases (I assume "wide" data format with repetitions over time in columns and cases in rows). Then perform a two-sample t-test comparing the post-pre differences between groups.

df$diff_weight<-df$weight_t1-df$weight_t0
t.test(diff_weight~group,data=df)

The problem with this approach is that you must perform separate tests to check whether the groups may have differed before treatment and became more similar later. This will require further tests and therefore the solution is easy, but meh.

2.) A mixed within-between ANOVA:

Nice examples can be found here. You need to sort all values in "long format" first (all measurements below each other) and create the variables "subjectID" (labels for subjects 1 to 50), "time" (0 or 1), and "group" (T, or D).

The syntax looks something like this:

model <- aov(weight ~ group*time + Error(subjectID/time), data=df_long)
summary(model)

This ANOVA tests both effects of

  • main effect group: mean differences in weight regardless of timepoint
  • main effect time: effect of repeated measurement regardless of group
  • interaction effect group*time: differences in the effect of time by group, (what you are mainly interested in)

... while accounting for the fact that weight-measurements are not independent, but paired in respect to time.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.