Tobias,

please check following papera:

Rosenblum R, Pikovsky A, Kurths J, Scha¨fer C, and Tass PA. Phase
synchronization: from theory to data analysis. In: Neuro-Informatics and
Neural Modelling, edited by Moss F and Gielen S. Amsterdam: North-
Holland (Elsevier Science), 2001, p. 279-321.

and others from the same group

I include some of my functions based on the previous paper

library(RSEIS)
library(seewave)
library(signal)
library(plyr)
library(RHRVR)

plot.phase<-function(xx,yy,sr){
ph.x=ifreq(detrend(xx),f=sr,phase=TRUE,plot=FALSE)
 ph.y=ifreq(detrend(yy),f=sr,phase=TRUE,plot=FALSE)
plot(ph.x$p[,1],unwrap(ph.x$p[,2]),type="l")
 lines(ph.y$p[,1],unwrap(ph.y$p[,2]),col="red")
}

mn.ratio<-function(xx,yy,sr){
ph=ifreq(detrend(xx),f=sr,phase=TRUE,plot=FALSE)
 ph1=ifreq(detrend(yy),f=sr,phase=TRUE,plot=FALSE)
phu=unwrap(ph$p[,2])
 ph1u=unwrap(ph1$p[,2])
lph=length(phu)
phe=phu[lph]
 ph1e=ph1u[lph]
return(phe/ph1e)
}

strobo<-function(data1,data2,sr,m,n) {
data1.detrend=detrend(data1)
 data2.detrend=detrend(data2)
data1.phase.all=ifreq(data1.detrend,sr,phase=TRUE,plot=FALSE)
 data2.phase.all=ifreq(data2.detrend,sr,phase=TRUE,plot=FALSE)
data1.phase=unwrap(data1.phase.all$p[,2])
 #data1.phase.t=data1.phase.all$p[,1]
data2.phase=unwrap(data2.phase.all$p[,2])
 #data2.phase.t=data2.phase.all$p[,1]
p2=2*pi
 data1.mod=data1.phase%%(p2*m)
data2.mod=data2.phase%%(p2*n)
n.bin=round(exp(0.626+0.4*log(length(data1)-1)),0)
 break.lim=seq(from=0,to=p2*m,by=p2*m/n.bin)
data1.bin=cut(data1.mod,breaks=break.lim,labels=FALSE)
 lambda1=rep(NA,n.bin)
for(ii in 1:n.bin){

lambda1[ii]=sum(exp(1i*data2.mod[data1.bin==ii]))/length(data2.mod[data1.bin==ii])
}
 lambda=sum(abs(lambda1))/n.bin
return(lambda)
}

time.to.min<-function(tme){
(tme-min(tme))/60
 }
rr.to.pos<-function(rri.in){
 tempa=cumsum(rri.in/1000)
return(tempa-tempa[1])
 }


regards

Milos

Miloš Žarković
Associate professor of Internal Medicine
School of Medicine, University of Belgrade
Clinic of Endocrinology, Clinical Centre of Serbia
11000 Belgrade
PAK 112113
Serbia
Phone +381 11 3639 724
Fax  +381 11 3639 776
email mzarkov@med.bg.ac.rs
        milos.zarkovic@gmail.com


On Thu, Sep 5, 2013 at 10:17 AM, Tobias Heed <tobias.heed@uni-hamburg.de>wrote:

> Hello to everyone,
>
> I would like to analyze a dependent variable that is in radians/degrees.
>
> Experiment/data:
> Specifically, the data is from a coordination task in which I test whether
> the synchrony of repetitive movements with the two hands changes with a
> number of conditions.
> The data I have is the phase difference between the movements of the two
> hands in each repetition of the movement.
> Thus, a value of 359° is almost the same as a value of 1° (with 359
> meaning that the second hand is leading by 1°, and 1 meaning it is
> following by 1°).
>
> Movements are mostly "exactly opposite" (imagine tapping with the two
> index fingers, first the one, than the other, numerous times), so that I
> have what looks like a normal distribution around 180° phase difference,
> but due to the type of data, I have long tails that are cut off at 0 and
> 360. But, there is also a small peak around 0 (would mean here that
> sometimes people accidentally tap the fingers together rather than
> successively), evident in small peaks at the end of the two tails (because
> "around 0" means it could be both 359 and 1, for example).
>
> My hypothesis is that synchrony is affected by some experimental
> conditions (coded as factors). This is evident in a wider distribution of
> the values around 180° in the conditions in which synchrony is worse.
> Previous studies have binned phase differences and run an ANOVA over the %
> of phase differences (accumulated over all trials) in a bin considered
> "quite according to instruction". Here, for example, they would consider
> all phase differences from 130-230° as correct (near enough to 180°). The
> advantage of this is that I can also bin data around the second peak (0°)
> by using 310-360° and 0-50° (which gets me around the problem that the data
> wrap around at 360°).
>
> Questions:
> I am wondering how to correctly analyze these data with a (G)LMM:
> 1. is there a GLMM link function for such data, or is there a
> transformation I can use to convert the dependent variable and run an LMM?
> 2, It seems problematic to me that if I were to use the degree values (or
> some transform of them), then the effect is in a change of data spread
> rather than in a change of mean. I am not sure how a predictor should code
> for this, and therefore I wonder whether I can use the degree values like
> this at all.
> 3, I have converted the degree value of each trial as
> "correct"/"incorrect" (as described above) and run a GLMM with a binomial
> link function. It works well, and the results make sense, but would this be
> considered an adequate approach?
>
> I am thankful for replies.
> Best,
> Tobias
>
> --
>
> --------------------------------------------------------------------------------------------------------------
> Tobias Heed, PhD
> Biological Psychology and Neuropsychology  |  University of Hamburg
> Von-Melle-Park 11, Room 208  |  D-20146 Hamburg, Germany
> Phone: (49) 40 - 42838 5831  |  Fax:   (49) 40 - 42838 6591
> tobias.heed@uni-hamburg.de  |  Website  |  Google Scholar  |  ResearcherID
>
> --------------------------------------------------------------------------------------------------------------
>
>
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-mixed-models@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>

	[[alternative HTML version deleted]]

