fitCyclic: Fits the cyclic model, using a simple linear model.

Description Usage Arguments Value Examples

View source: R/fitCyclic.R

Description

This function fits the cyclic model, using a simple linear model (see Verboon & Leontjevas, 2018)

Usage

1
2
3
fitCyclic(dat, yvar = NULL, xvar = NULL, grp = NULL, cov = NULL,
  P = NULL, ymin = -1, ymax = 1, step = 0.25, xlabs = NULL,
  ylabs = NULL)

Arguments

dat

data frame containing the variables

yvar

dependent variable

xvar

time variabele, usually indicates the beeps or other numerical variable. Time format is also possible.

grp

group variabele indicator, usually indicates the days, used in "raw" plot.

cov

vector of names containing additional variabeles (e.g. cov = c("x1", "daynr"))

P

the periodicity of the cycle. If NULL P will be computed from the data.

ymin, ymax, step

parameters that control axes of the plot

xlabs, ylabs

labels respectively for x-axis and y-axis of the plots

Value

list containing the following elements:

parameters = amplitude and phase

fit = object from lm()

rawDataPlot = plot of predicted values for all observations

meansPlot = plot with predictions averaged over subjects,

oneCyclePlot = plot with predictions for one cycle,

Examples

1
2
data("pdat")
fitCyclic(dat=pdat, yvar = "stress", xvar = "beepnr", grp = "daynr")

PeterVerboon/cyclicpkg documentation built on March 4, 2020, 1:27 p.m.