esmNetwork: Compute network of ESM variables using lags

Description Usage Arguments Value Examples

View source: R/esmNetwork.R

Description

Based om lagged variables from an ESM study a network is constructed.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
esmNetwork(
  dat,
  subjnr,
  level1,
  level2 = NULL,
  vars,
  covs = NULL,
  randomAll = FALSE,
  randomVars = NULL,
  randomIcept = TRUE,
  fixedIcept = TRUE,
  groups = NULL,
  lagn = 1,
  centerType = "person",
  optim = "bobyqa",
  layout = "spring",
  labs = NULL,
  solid = 0.1,
  plimit = 0.05,
  titlePlot = "Figure"
)

Arguments

dat

data frame

subjnr

variable name, indicating the subjects

level1

variable name, indicating level 1 variable, e.g. beeps

level2

variable name, indicating level 2 variable, e.g. days

vars

vector with the names of the variables for which the network is computed

covs

covariates in the analyses, which are not plotted in the network. Covariates are not lagged and not centered.

randomAll

logical indicates whether all variables should be used as random effects

randomVars

vector of variable names, used as random effects

randomIcept

logical indicating whether there is a random intercept (TRUE) or not (FALSE)

fixedIcept

logical indicating whether there is a fixed intercept (TRUE) or not (FALSE)

groups

variable used to label groups of variables in the network figure

lagn

number of lags used in the network

centerType

vector of same length as vars that indicates for each variable which centering must be, applied, either "person" or "grand_mean" or a number. If only "person" or "grand_mean" is specified (default), all variables are person or grand-mean centered, respectively. If centerType is NULL no variables are centered.

optim

optimizer used in lmer, options: "bobyqa" or "Nelder_Mead", see lmerControl (lme4)

layout

layout specification of plot (see options in qgraph)

labs

labels used in the network plot

solid

effect size above which lines are shown as solid (default = .10)

plimit

p-value under which lines are shown (default = .05)

titlePlot

title for the plot

Value

a qgraph object (network) that can be plotted and the centrality measures

Examples

1
2
3
4
5
6
data("news")
vars <- c("Fearful","Hopeful","Anxious","Down","Irritated","Relaxed","Insecure")
labs <- c("FF","HO","ANX","DOW", "IRR","REL","INS")
res <- esmNetwork(dat = news, subjnr="subjnr",level1 = "beepnr",
                  level2= "daynr", vars = vars, labs = labs, lagn = 1)
       

PeterVerboon/lagnetw documentation built on Aug. 4, 2020, 5:16 p.m.