# NOT RUN {
#Abstract example
x <- seq(0,2*pi,length.out=11)
y <- c(0,1,2,3,4,5,4,3,2,1,0)
yfromx(0:6,x,y)
#BCI data example
#Weighting ocelot activity pattern to correct for variation in speed
data(BCIspeed)
data(BCItime)
#Fit linear-circular model to log(speed)
i <- BCIspeed$species=="ocelot"
lcfit <- fitlincirc(BCIspeed$time[i]*2*pi, log(BCIspeed$speed[i]), reps=50)
#Fit weighted activity model using yfromx to create weights
j <- BCItime$species=="ocelot"
tdat <- BCItime$time[j]*2*pi
w <- 1/yfromx(tdat, lcfit@fit$x, exp(lcfit@fit$fit))
mod <- fitact(tdat, wt=w, sample="none")
plot(mod)
#Oveplot unweighted model for comparison
mod2 <- fitact(tdat, sample="none")
plot(mod2, lcol=3, add=TRUE)
# }
Run the code above in your browser using DataLab