ezPerm within vs. between and repeated measures

102 views
Skip to first unread message

ljk...@hotmail.com

unread,
Mar 29, 2017, 2:30:22 PM3/29/17
to ez4r
Hello,
This is my first time writing in Google groups so apologies if I'm somehow not following the rules of posting.

I have a dataset (called jun) with repeated measures within a group not between groups - the data looks something like this:

TrapID lat.group log.pul
1              A      0.1 
1              A      0.2 
2              A      0.3 
3              B      0.5 
3              B      0.6 
3              B      0.7 
4              B      0.1 
4              B      0.2 
5              C      0.3 
5              C      0.5 
6              C      0.6 
7              C      0.7 


So I have repeated measures within each group (so the same TrapID (subject) will only appear in 1 group), but it is unbalanced as not all subjects have the same amount of repeats. I know for sure that the data isn't normal, so I have been trying to run ezPerm to test for differences between groups. I found the below R-script in the package documentation, and since this is my first time using permuation tests, I'm afraid that I may not understand it correctly or if I am running the right test. The below script is testing differences between groups and not within (which is exactly what I want) - but I am unsure as to whether it takes the repeated observations into account. Can someone help me out here or point me in the right direction?
Thanks,
Lene


#Compute some useful statistics per cell.
cell_stats = ddply(
  .data = jun
  , .variables = .( TrapID , lat.group  )
  , .fun = function(x){
    #Compute mean RT (only accurate trials).
    mean_rt = mean(x$log.pul)
    #Compute SD RT (only accurate trials).
    sd_rt = sd(x$log.pul)
    to_return = data.frame(
      mean_rt = mean_rt
      , sd_rt = sd_rt
    )
    return(to_return)
  }
)
#Compute the grand mean RT per Ss.
gmrt = ddply(
  .data = cell_stats
  , .variables = .(TrapID ,lat.group )
  , .fun = function(x){
    to_return = data.frame(
      mrt = mean(x$mean_rt)
    )
    return(to_return)
  }
)
#Run a purely between-Ss permutation test on the mean_rt data.
mean_rt_perm = ezPerm(
  data = gmrt
  , dv = mrt
  , wid =TrapID
  , between =lat.group
  , perms = 1e3 #1e3 or higher is best for publication
)


#Show the Permutation test.
print(mean_rt_perm)
Reply all
Reply to author
Forward
0 new messages