R Markdown

#load the mVAR library
library(rmarkdown)
library(knitr)
library("gridExtra")
library("devtools")
## Loading required package: usethis
library("networktools")
## Registered S3 method overwritten by 'R.oo':
##   method        from       
##   throw.default R.methodsS3
## Registered S3 methods overwritten by 'car':
##   method                          from
##   influence.merMod                lme4
##   cooks.distance.influence.merMod lme4
##   dfbeta.influence.merMod         lme4
##   dfbetas.influence.merMod        lme4
library("mlVAR")
## Registered S3 methods overwritten by 'huge':
##   method    from   
##   plot.sim  BDgraph
##   print.sim BDgraph
library("qgraph")
library(apaTables)
## Warning: package 'apaTables' was built under R version 3.6.2
library(tidyverse)
## -- Attaching packages ------------------------------------------------------------------------------ tidyverse 1.3.0 --
## v ggplot2 3.2.1     v purrr   0.3.3
## v tibble  2.1.3     v dplyr   0.8.3
## v tidyr   1.0.0     v stringr 1.4.0
## v readr   1.3.1     v forcats 0.4.0
## Warning: package 'ggplot2' was built under R version 3.6.2
## Warning: package 'dplyr' was built under R version 3.6.2
## -- Conflicts --------------------------------------------------------------------------------- tidyverse_conflicts() --
## x dplyr::combine() masks gridExtra::combine()
## x dplyr::filter()  masks stats::filter()
## x dplyr::lag()     masks stats::lag()
# check version  - mlvar should be 0.4.1 and network tools is 1.2.1

packageVersion("mlVAR")
## [1] '0.4.4'
packageVersion("networktools")
## [1] '1.2.2'
#read in the csv file note this is for he WEEK
networkDataday<-read.csv("LSM_R.csv",header=TRUE)
networkDataweek<-read.csv("LSM_W1.csv",header=TRUE)

This first series of analyses will be for the within-day effects. This uses data that was collected at 8 AM to 8 PM and every 4 hours in between. Variables across models are identical, so I set those up first.

#CREATE CORRELATION TABLES

dayc <- networkDataday %>% dplyr::select(3:10)
weekc <- networkDataweek %>% dplyr::select(3:10)

apa.cor.table(dayc, filename = "networkdaycor.doc", table.number = 1,
  show.conf.interval=FALSE, landscape = TRUE)
## The ability to suppress reporting of reporting confidence intervals has been deprecated in this version.
## The function argument show.conf.interval will be removed in a later version.
## 
## 
## Table 1 
## 
## Means, standard deviations, and correlations with confidence intervals
##  
## 
##   Variable  M    SD   1          2          3          4         
##   1. STRESS 3.42 1.92                                            
##                                                                  
##   2. DEP    3.09 1.81 .74**                                      
##                       [.71, .77]                                 
##                                                                  
##   3. ANGER  3.62 2.01 .70**      .68**                           
##                       [.67, .73] [.65, .71]                      
##                                                                  
##   4. HATE   2.99 1.92 .50**      .53**      .59**                
##                       [.46, .54] [.49, .57] [.55, .63]           
##                                                                  
##   5. GUILT  2.45 1.49 .37**      .35**      .34**      .31**     
##                       [.31, .42] [.29, .40] [.29, .39] [.25, .36]
##                                                                  
##   6. REGRET 2.36 1.44 .30**      .26**      .34**      .31**     
##                       [.25, .36] [.21, .32] [.29, .39] [.26, .37]
##                                                                  
##   7. EMP    3.71 1.79 .30**      .24**      .32**      .23**     
##                       [.24, .35] [.18, .30] [.26, .37] [.17, .28]
##                                                                  
##   8. PURP   3.83 1.84 .36**      .30**      .35**      .26**     
##                       [.30, .41] [.24, .35] [.29, .40] [.20, .32]
##                                                                  
##   5          6          7         
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##   .50**                           
##   [.45, .54]                      
##                                   
##   .25**      .22**                
##   [.19, .30] [.16, .27]           
##                                   
##   .27**      .23**      .77**     
##   [.21, .32] [.18, .29] [.74, .79]
##                                   
## 
## Note. M and SD are used to represent mean and standard deviation, respectively.
## Values in square brackets indicate the 95% confidence interval.
## The confidence interval is a plausible range of population correlations 
## that could have caused the sample correlation (Cumming, 2014).
## * indicates p < .05. ** indicates p < .01.
## 
apa.cor.table(weekc, filename = "networkweek.doc", table.number = 2,
  show.conf.interval=FALSE, landscape = TRUE)
## The ability to suppress reporting of reporting confidence intervals has been deprecated in this version.
## The function argument show.conf.interval will be removed in a later version.
## 
## 
## Table 2 
## 
## Means, standard deviations, and correlations with confidence intervals
##  
## 
##   Variable  M    SD   1          2          3          4         
##   1. STRESS 3.84 1.82                                            
##                                                                  
##   2. DEP    3.33 1.79 .77**                                      
##                       [.75, .80]                                 
##                                                                  
##   3. ANGER  3.99 1.90 .73**      .74**                           
##                       [.69, .76] [.71, .76]                      
##                                                                  
##   4. HATE   3.23 1.87 .50**      .52**      .61**                
##                       [.45, .54] [.47, .57] [.57, .65]           
##                                                                  
##   5. GUILT  2.41 1.40 .27**      .28**      .28**      .23**     
##                       [.21, .32] [.22, .34] [.22, .34] [.17, .29]
##                                                                  
##   6. REGRET 2.35 1.32 .28**      .29**      .27**      .25**     
##                       [.22, .34] [.23, .35] [.21, .33] [.19, .31]
##                                                                  
##   7. EMP    4.07 1.74 .31**      .22**      .31**      .16**     
##                       [.25, .37] [.16, .28] [.25, .36] [.10, .22]
##                                                                  
##   8. PURP   4.18 1.80 .36**      .26**      .31**      .17**     
##                       [.31, .42] [.20, .32] [.25, .37] [.11, .23]
##                                                                  
##   5          6          7         
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##                                   
##   .59**                           
##   [.55, .63]                      
##                                   
##   .23**      .23**                
##   [.17, .29] [.17, .29]           
##                                   
##   .24**      .23**      .81**     
##   [.18, .30] [.16, .29] [.78, .83]
##                                   
## 
## Note. M and SD are used to represent mean and standard deviation, respectively.
## Values in square brackets indicate the 95% confidence interval.
## The confidence interval is a plausible range of population correlations 
## that could have caused the sample correlation (Cumming, 2014).
## * indicates p < .05. ** indicates p < .01.
## 
#names of the variables
vars = c("STRESS", "DEP", "ANGER", 
         "HATE", "GUILT", "REGRET", "EMP", "PURP")
#name the id variable
#data should be in longform... 
idvar = c("ID")
#name the beep variable
#pretty sure this is a differnet form of "day" variable
beepvar=c("TIME")

##Day Model

#run the model  - Model 10 neg emotions, 4 PTSD clusters (excludes PTSD item 11)
#NOTE THAT THE NAMES OF VARIABLES NEED TO MATCH NAMES IN TEH DATASET.
modelNewday<-mlVAR(networkDataday, vars=vars, idvar=idvar,lags=1, estimator="lmer", contemporaneous="orthogonal", temporal="orthogonal", verbose=TRUE, beepvar="TIME")
## Warning in mlVAR(networkDataday, vars = vars, idvar = idvar, lags = 1,
## estimator = "lmer", : 275 subjects detected with < 20 measurements. This is
## not recommended, as within-person centering with too few observations per
## subject will lead to biased estimates (most notably: negative self-loops).
## Estimating temporal and between-subjects effects
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |========                                                         |  12%
  |                                                                       
  |================                                                 |  25%
  |                                                                       
  |========================                                         |  38%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |=========================================                        |  62%
  |                                                                       
  |=================================================                |  75%
  |                                                                       
  |=========================================================        |  88%
  |                                                                       
  |=================================================================| 100%
## Estimating contemporaneous effects
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |========                                                         |  12%
  |                                                                       
  |================                                                 |  25%
  |                                                                       
  |========================                                         |  38%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |=========================================                        |  62%
  |                                                                       
  |=================================================                |  75%
  |                                                                       
  |=========================================================        |  88%
  |                                                                       
  |=================================================================| 100%
## Computing random effects
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |                                                                 |   1%
  |                                                                       
  |=                                                                |   1%
  |                                                                       
  |=                                                                |   2%
  |                                                                       
  |==                                                               |   3%
  |                                                                       
  |==                                                               |   4%
  |                                                                       
  |===                                                              |   4%
  |                                                                       
  |===                                                              |   5%
  |                                                                       
  |====                                                             |   5%
  |                                                                       
  |====                                                             |   6%
  |                                                                       
  |====                                                             |   7%
  |                                                                       
  |=====                                                            |   7%
  |                                                                       
  |=====                                                            |   8%
  |                                                                       
  |======                                                           |   9%
  |                                                                       
  |======                                                           |  10%
  |                                                                       
  |=======                                                          |  10%
  |                                                                       
  |=======                                                          |  11%
  |                                                                       
  |========                                                         |  12%
  |                                                                       
  |========                                                         |  13%
  |                                                                       
  |=========                                                        |  13%
  |                                                                       
  |=========                                                        |  14%
  |                                                                       
  |=========                                                        |  15%
  |                                                                       
  |==========                                                       |  15%
  |                                                                       
  |==========                                                       |  16%
  |                                                                       
  |===========                                                      |  16%
  |                                                                       
  |===========                                                      |  17%
  |                                                                       
  |============                                                     |  18%
  |                                                                       
  |============                                                     |  19%
  |                                                                       
  |=============                                                    |  19%
  |                                                                       
  |=============                                                    |  20%
  |                                                                       
  |=============                                                    |  21%
  |                                                                       
  |==============                                                   |  21%
  |                                                                       
  |==============                                                   |  22%
  |                                                                       
  |===============                                                  |  23%
  |                                                                       
  |===============                                                  |  24%
  |                                                                       
  |================                                                 |  24%
  |                                                                       
  |================                                                 |  25%
  |                                                                       
  |=================                                                |  25%
  |                                                                       
  |=================                                                |  26%
  |                                                                       
  |=================                                                |  27%
  |                                                                       
  |==================                                               |  27%
  |                                                                       
  |==================                                               |  28%
  |                                                                       
  |===================                                              |  29%
  |                                                                       
  |===================                                              |  30%
  |                                                                       
  |====================                                             |  30%
  |                                                                       
  |====================                                             |  31%
  |                                                                       
  |=====================                                            |  32%
  |                                                                       
  |=====================                                            |  33%
  |                                                                       
  |======================                                           |  33%
  |                                                                       
  |======================                                           |  34%
  |                                                                       
  |======================                                           |  35%
  |                                                                       
  |=======================                                          |  35%
  |                                                                       
  |=======================                                          |  36%
  |                                                                       
  |========================                                         |  36%
  |                                                                       
  |========================                                         |  37%
  |                                                                       
  |=========================                                        |  38%
  |                                                                       
  |=========================                                        |  39%
  |                                                                       
  |==========================                                       |  39%
  |                                                                       
  |==========================                                       |  40%
  |                                                                       
  |==========================                                       |  41%
  |                                                                       
  |===========================                                      |  41%
  |                                                                       
  |===========================                                      |  42%
  |                                                                       
  |============================                                     |  43%
  |                                                                       
  |============================                                     |  44%
  |                                                                       
  |=============================                                    |  44%
  |                                                                       
  |=============================                                    |  45%
  |                                                                       
  |==============================                                   |  45%
  |                                                                       
  |==============================                                   |  46%
  |                                                                       
  |==============================                                   |  47%
  |                                                                       
  |===============================                                  |  47%
  |                                                                       
  |===============================                                  |  48%
  |                                                                       
  |================================                                 |  49%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |=================================                                |  50%
  |                                                                       
  |=================================                                |  51%
  |                                                                       
  |==================================                               |  52%
  |                                                                       
  |==================================                               |  53%
  |                                                                       
  |===================================                              |  53%
  |                                                                       
  |===================================                              |  54%
  |                                                                       
  |===================================                              |  55%
  |                                                                       
  |====================================                             |  55%
  |                                                                       
  |====================================                             |  56%
  |                                                                       
  |=====================================                            |  56%
  |                                                                       
  |=====================================                            |  57%
  |                                                                       
  |======================================                           |  58%
  |                                                                       
  |======================================                           |  59%
  |                                                                       
  |=======================================                          |  59%
  |                                                                       
  |=======================================                          |  60%
  |                                                                       
  |=======================================                          |  61%
  |                                                                       
  |========================================                         |  61%
  |                                                                       
  |========================================                         |  62%
  |                                                                       
  |=========================================                        |  63%
  |                                                                       
  |=========================================                        |  64%
  |                                                                       
  |==========================================                       |  64%
  |                                                                       
  |==========================================                       |  65%
  |                                                                       
  |===========================================                      |  65%
  |                                                                       
  |===========================================                      |  66%
  |                                                                       
  |===========================================                      |  67%
  |                                                                       
  |============================================                     |  67%
  |                                                                       
  |============================================                     |  68%
  |                                                                       
  |=============================================                    |  69%
  |                                                                       
  |=============================================                    |  70%
  |                                                                       
  |==============================================                   |  70%
  |                                                                       
  |==============================================                   |  71%
  |                                                                       
  |===============================================                  |  72%
  |                                                                       
  |===============================================                  |  73%
  |                                                                       
  |================================================                 |  73%
  |                                                                       
  |================================================                 |  74%
  |                                                                       
  |================================================                 |  75%
  |                                                                       
  |=================================================                |  75%
  |                                                                       
  |=================================================                |  76%
  |                                                                       
  |==================================================               |  76%
  |                                                                       
  |==================================================               |  77%
  |                                                                       
  |===================================================              |  78%
  |                                                                       
  |===================================================              |  79%
  |                                                                       
  |====================================================             |  79%
  |                                                                       
  |====================================================             |  80%
  |                                                                       
  |====================================================             |  81%
  |                                                                       
  |=====================================================            |  81%
  |                                                                       
  |=====================================================            |  82%
  |                                                                       
  |======================================================           |  83%
  |                                                                       
  |======================================================           |  84%
  |                                                                       
  |=======================================================          |  84%
  |                                                                       
  |=======================================================          |  85%
  |                                                                       
  |========================================================         |  85%
  |                                                                       
  |========================================================         |  86%
  |                                                                       
  |========================================================         |  87%
  |                                                                       
  |=========================================================        |  87%
  |                                                                       
  |=========================================================        |  88%
  |                                                                       
  |==========================================================       |  89%
  |                                                                       
  |==========================================================       |  90%
  |                                                                       
  |===========================================================      |  90%
  |                                                                       
  |===========================================================      |  91%
  |                                                                       
  |============================================================     |  92%
  |                                                                       
  |============================================================     |  93%
  |                                                                       
  |=============================================================    |  93%
  |                                                                       
  |=============================================================    |  94%
  |                                                                       
  |=============================================================    |  95%
  |                                                                       
  |==============================================================   |  95%
  |                                                                       
  |==============================================================   |  96%
  |                                                                       
  |===============================================================  |  96%
  |                                                                       
  |===============================================================  |  97%
  |                                                                       
  |================================================================ |  98%
  |                                                                       
  |================================================================ |  99%
  |                                                                       
  |=================================================================|  99%
  |                                                                       
  |=================================================================| 100%
#save the model
save(modelNewday, file="modelNewday.Rdata")

#load the model
load("modelNewday.Rdata")

##Week Model

#run the model  - Model 10 neg emotions, 4 PTSD clusters (excludes PTSD item 11)
#NOTE THAT THE NAMES OF VARIABLES NEED TO MATCH NAMES IN TEH DATASET.
modelNewweek<-mlVAR(networkDataweek, vars=vars, idvar=idvar,lags=1, estimator="lmer", contemporaneous="orthogonal", temporal="orthogonal", verbose=TRUE, beepvar="TIME")
## Warning in mlVAR(networkDataweek, vars = vars, idvar = idvar, lags = 1, :
## 230 subjects detected with < 20 measurements. This is not recommended, as
## within-person centering with too few observations per subject will lead to
## biased estimates (most notably: negative self-loops).
## Estimating temporal and between-subjects effects
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |========                                                         |  12%
  |                                                                       
  |================                                                 |  25%
  |                                                                       
  |========================                                         |  38%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |=========================================                        |  62%
  |                                                                       
  |=================================================                |  75%
  |                                                                       
  |=========================================================        |  88%
  |                                                                       
  |=================================================================| 100%
## Estimating contemporaneous effects
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |========                                                         |  12%
  |                                                                       
  |================                                                 |  25%
  |                                                                       
  |========================                                         |  38%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |=========================================                        |  62%
  |                                                                       
  |=================================================                |  75%
  |                                                                       
  |=========================================================        |  88%
  |                                                                       
  |=================================================================| 100%
## Computing random effects
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |=                                                                |   1%
  |                                                                       
  |=                                                                |   2%
  |                                                                       
  |==                                                               |   3%
  |                                                                       
  |===                                                              |   4%
  |                                                                       
  |===                                                              |   5%
  |                                                                       
  |====                                                             |   6%
  |                                                                       
  |====                                                             |   7%
  |                                                                       
  |=====                                                            |   7%
  |                                                                       
  |=====                                                            |   8%
  |                                                                       
  |======                                                           |   9%
  |                                                                       
  |======                                                           |  10%
  |                                                                       
  |=======                                                          |  10%
  |                                                                       
  |=======                                                          |  11%
  |                                                                       
  |========                                                         |  12%
  |                                                                       
  |========                                                         |  13%
  |                                                                       
  |=========                                                        |  13%
  |                                                                       
  |=========                                                        |  14%
  |                                                                       
  |==========                                                       |  15%
  |                                                                       
  |==========                                                       |  16%
  |                                                                       
  |===========                                                      |  17%
  |                                                                       
  |============                                                     |  18%
  |                                                                       
  |============                                                     |  19%
  |                                                                       
  |=============                                                    |  20%
  |                                                                       
  |==============                                                   |  21%
  |                                                                       
  |==============                                                   |  22%
  |                                                                       
  |===============                                                  |  23%
  |                                                                       
  |================                                                 |  24%
  |                                                                       
  |================                                                 |  25%
  |                                                                       
  |=================                                                |  26%
  |                                                                       
  |=================                                                |  27%
  |                                                                       
  |==================                                               |  27%
  |                                                                       
  |==================                                               |  28%
  |                                                                       
  |===================                                              |  29%
  |                                                                       
  |===================                                              |  30%
  |                                                                       
  |====================                                             |  30%
  |                                                                       
  |====================                                             |  31%
  |                                                                       
  |=====================                                            |  32%
  |                                                                       
  |=====================                                            |  33%
  |                                                                       
  |======================                                           |  33%
  |                                                                       
  |======================                                           |  34%
  |                                                                       
  |=======================                                          |  35%
  |                                                                       
  |=======================                                          |  36%
  |                                                                       
  |========================                                         |  37%
  |                                                                       
  |=========================                                        |  38%
  |                                                                       
  |=========================                                        |  39%
  |                                                                       
  |==========================                                       |  40%
  |                                                                       
  |===========================                                      |  41%
  |                                                                       
  |===========================                                      |  42%
  |                                                                       
  |============================                                     |  43%
  |                                                                       
  |=============================                                    |  44%
  |                                                                       
  |=============================                                    |  45%
  |                                                                       
  |==============================                                   |  46%
  |                                                                       
  |==============================                                   |  47%
  |                                                                       
  |===============================                                  |  47%
  |                                                                       
  |===============================                                  |  48%
  |                                                                       
  |================================                                 |  49%
  |                                                                       
  |================================                                 |  50%
  |                                                                       
  |=================================                                |  50%
  |                                                                       
  |=================================                                |  51%
  |                                                                       
  |==================================                               |  52%
  |                                                                       
  |==================================                               |  53%
  |                                                                       
  |===================================                              |  53%
  |                                                                       
  |===================================                              |  54%
  |                                                                       
  |====================================                             |  55%
  |                                                                       
  |====================================                             |  56%
  |                                                                       
  |=====================================                            |  57%
  |                                                                       
  |======================================                           |  58%
  |                                                                       
  |======================================                           |  59%
  |                                                                       
  |=======================================                          |  60%
  |                                                                       
  |========================================                         |  61%
  |                                                                       
  |========================================                         |  62%
  |                                                                       
  |=========================================                        |  63%
  |                                                                       
  |==========================================                       |  64%
  |                                                                       
  |==========================================                       |  65%
  |                                                                       
  |===========================================                      |  66%
  |                                                                       
  |===========================================                      |  67%
  |                                                                       
  |============================================                     |  67%
  |                                                                       
  |============================================                     |  68%
  |                                                                       
  |=============================================                    |  69%
  |                                                                       
  |=============================================                    |  70%
  |                                                                       
  |==============================================                   |  70%
  |                                                                       
  |==============================================                   |  71%
  |                                                                       
  |===============================================                  |  72%
  |                                                                       
  |===============================================                  |  73%
  |                                                                       
  |================================================                 |  73%
  |                                                                       
  |================================================                 |  74%
  |                                                                       
  |=================================================                |  75%
  |                                                                       
  |=================================================                |  76%
  |                                                                       
  |==================================================               |  77%
  |                                                                       
  |===================================================              |  78%
  |                                                                       
  |===================================================              |  79%
  |                                                                       
  |====================================================             |  80%
  |                                                                       
  |=====================================================            |  81%
  |                                                                       
  |=====================================================            |  82%
  |                                                                       
  |======================================================           |  83%
  |                                                                       
  |=======================================================          |  84%
  |                                                                       
  |=======================================================          |  85%
  |                                                                       
  |========================================================         |  86%
  |                                                                       
  |========================================================         |  87%
  |                                                                       
  |=========================================================        |  87%
  |                                                                       
  |=========================================================        |  88%
  |                                                                       
  |==========================================================       |  89%
  |                                                                       
  |==========================================================       |  90%
  |                                                                       
  |===========================================================      |  90%
  |                                                                       
  |===========================================================      |  91%
  |                                                                       
  |============================================================     |  92%
  |                                                                       
  |============================================================     |  93%
  |                                                                       
  |=============================================================    |  93%
  |                                                                       
  |=============================================================    |  94%
  |                                                                       
  |==============================================================   |  95%
  |                                                                       
  |==============================================================   |  96%
  |                                                                       
  |===============================================================  |  97%
  |                                                                       
  |================================================================ |  98%
  |                                                                       
  |================================================================ |  99%
  |                                                                       
  |=================================================================| 100%
#save the model
save(modelNewweek, file="modelNewweek.Rdata")

#load the model
load("modelNewweek.Rdata")
#names of the symptoms
symptoms <- c("stress", "depressed", "angry", "hate", "guilt", 
         "regret", "empowered", "purpose")

# group defined here
gr<- list(c(1:2),c(3:4), c(5,6), c(7:8))           
# Compute the networks and layout:
between <- plot(modelNewday, "between", nonsig="hide", rule = "and")

contemporaneous<- plot(modelNewday, "contemporaneous", nonsig="hide", rule = "and")

temporal <- plot(modelNewday, "temporal", nonsig = "hide")

Layout <- averageLayout(contemporaneous, temporal)
# Compute the networks and layout:
betweenw <- plot(modelNewweek, "between", nonsig="hide", rule = "and")

contemporaneousw <- plot(modelNewweek, "contemporaneous", nonsig="hide", rule = "and")

temporalw <- plot(modelNewweek, "temporal", nonsig = "hide")

Layoutw <- averageLayout(contemporaneousw, temporalw)
###########plot contemporaneous in average layout - all connections here#################

#plot pdf colour
pdf("Between_day.pdf",width=13.5,height=8)
qgraph(between, vsize=7, title = "", theme = "colorblind", legend.cex=.82, border.width=1.5, border.color="black", 
       layout = Layout, cut = 0)
dev.off()
## png 
##   2
pdf("Contemporaneous_DAY.pdf",width=13.5,height=8)
qgraph(contemporaneous, vsize=7, title = "", theme = "colorblind", legend.cex=.82,  border.width=1.5, border.color="black", cut = 0, layout = Layout)
dev.off()
## png 
##   2
pdf("Temporal_DAY.pdf",width=13.5,height=8)
qgraph(temporal, vsize=7, title = "", theme = "colorblind", legend.cex=.82, border.width=1.5, border.color="black",
layout = Layout, cut = 0)
dev.off()
## png 
##   2
##########plot temporal in average layout - all connections here#############

#plot pdf colour

pdf("Between_week.pdf",width=13.5,height=8)
qgraph(betweenw, vsize=7, title = "", theme = "colorblind", legend.cex=.82, border.width=1.5, border.color="black",
layout = Layoutw, cut = 0)
dev.off()
## png 
##   2
pdf("Contemporaneous_WEEK.pdf",width=13.5,height=8)
qgraph(contemporaneousw, vsize=7, title = "", theme = "colorblind", legend.cex=.82,  border.width=1.5, border.color="black", cut = 0, layout = Layoutw)
dev.off()
## png 
##   2
pdf("Temporal_week.pdf",width=13.5,height=8)
qgraph(temporalw, vsize=7, title = "", theme = "colorblind", legend.cex=.82, border.width=1.5, border.color="black", 
layout = Layoutw, cut = 0)
dev.off()
## png 
##   2