fitCyclicMLA: Fits the cyclic model on ESM data.

Description Usage Arguments Value Examples

View source: R/fitCyclicMLA.R

Description

This function fits the cyclic model on ESM data, using a multilevel model (see Verboon & Leontjevas, 2018)

Usage

1
2
3
fitCyclicMLA(dat, yvar = NULL, xvar1 = NULL, xvar2 = NULL,
  id = NULL, cov = NULL, ncycle = 1, P = NULL, P2 = NULL,
  random = "intercept")

Arguments

dat

data frame containing variables

yvar

dependent variable

xvar1

time variabele indicator of first or only cycle

xvar2

time variabele indicator of second (longer) cycle

id

group (subjects, clusters) identifier

cov

additional variabels in the model

ncycle

is the number of cyclic processes in the model (1 = 1, otherwise = 2)

P

is the periodicity of the first cyclic process

P2

is the periodicity of the second cyclic process

random

keyword indicating which terms should be random effect in the model. The following keywords are available: "intercept"= intercept only; "first"= cyclic parameters of first cyclic process; "second" = cyclic parameters of second cyclic process; "cov" = covariates only, no cyclic terms; and finally "all" = all terms

Value

list containing the following elements:

parameters = intercept, amplitude and phase (and other terms in the model)

fit = object from lmer()

formula = specification of lmer model

period = specified periodicity of cyclic process

Examples

1
2
3
4
 data("smokedat")
  model <- fitCyclicMLA(dat=smokedat,  yvar="intention", xvar1="beepnr",
  xvar2="daynr", id = "subjnr", random = "all",
  ncycle = 1, cov = c("stress", "positiveAffect"))

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