0

I have a dataset with 6-time points and I hope to do multiple paired sample t-tests to compare the scores.

data

The data has been transformed into the long one

data1

I want to achieve something like this table: T TEST

I tried to use the following code, but it does not work.

stat.test <- anxiety_score %>%
  group_by(group) %>%
  pairwise_t_test(
    anxiety_score ~ time, paired = TRUE, 
    p.adjust.method = "bonferroni"
  ) %>%
  select(-df, -statistic, -p) # Remove details
stat.test
Zhen
  • 1
  • 4
  • There is an error shows: Error in UseMethod("group_by") : no applicable method for 'group_by' applied to an object of class "c('double', 'numeric')" – Zhen Sep 28 '22 at 01:50
  • The `group_by` function seems incapable of recognizing that your numeric variable is discrete. Maybe you need to group by a factor or character variable? The code worked with anxiety_score but you showed the output of `data`. So we cannot tell why the error occurred. Instead of posting pictures of data present the data object as text using `dput()`. – IRTFM Sep 28 '22 at 02:23
  • Is your dataframe named "anxiety_score" or is it named "data", i.e. instead of starting with `stat.test <- anxiety_score %>% group_by(group) %>% etc` perhaps you want `stat.test <- data %>% group_by(group) %>% etc`? – jared_mamrot Sep 28 '22 at 04:01
  • Please beware that the method above will not adjust for multiple testing, and that your data may not meet the assumptions for a t-test, as there is dependence in the data. – mhovd Sep 28 '22 at 07:39

0 Answers0