multilag: Compute and plot cosine of velocity vectors at each of a set...

Description Usage Arguments Value Examples

View source: R/multilag.R

Description

Inputs a dyadic motion object outputted by make.fd, computes cosine of the two individuals' velocity vectors at each of the provided lag values, and makes a plot.

Usage

1
2
3
4
multilag(obj, timerange = NULL, lagvec = -2:2/10, npoints = 701,
  power = 1, power.plot = 1, plot = "fields",
  legend.args = list(text = "", side = 3), horizontal = FALSE,
  xlab = "Time", ylab = "Lag", ...)

Arguments

obj

A dyadic motion object outputted by make.fd.

timerange

Time range to include in the plot. If NULL, the entire recorded time range.

lagvec

Vector of lag values.

npoints

Number of time points, within timerange, to include in the plots.

power

Power to which the computed cosine is raised.

power.plot

Power to which the plotted cosine is raised.

plot

Either "fields", to use image.plot for a color plot of the cosine matrix; or "ggplot", to use ggplot to plot the cosines as a function of time for each lag.

legend.args, horizontal

Passed to image.plot.

xlab, ylab

x- and y-axis labels.

...

Other arguments to the plotting function.

Value

A list with components

data.frame

Data frame used to make the plot

cosmat

Matrix of cosines

timerange

The time range supplied

Examples

1
2
3
4
5
6
7
8
9
# Two types of lag plots, as in Figs. 5 and 6 of Reiss, Gvirts et al.
data(sync.fd)
rnge <- c(61,62.2)  

fig5 <- multilag(sync.fd, lagvec=seq(-.4,.4,,31), npoints=801, horizontal=TRUE)
abline(v=rnge[1], col="red")
abline(v=rnge[2], col="red")

fig6 <- multilag(sync.fd, rnge, plot="ggplot")

reissphil/cvv documentation built on May 21, 2019, 10:08 a.m.