# yfromx: Impute empirical circular distribution. In activity: Animal Activity Statistics

## Description

Imputes values at given points on an empirical circular distribution.

## Usage

 `1` ```yfromx(xvals, x, y) ```

## Arguments

 `xvals` Numeric circular values at which to evaluate `y` `x` Evenly spaced ascending numeric sequence of circular values `y` Empirical numeric output distribution matched with `x`

## Details

Note that x is assumed circular, so first and last `y` values should be equal. Evaluation points `xvals` should also be within the range of `x`.

## Value

A numeric vector of `y` values evaluated at `xvals`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```#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) ```

activity documentation built on May 30, 2017, 8:18 a.m.