Search code examples
rcorrelationprocessr

The modSummary function of processR package resturns NULL


I'm trying to learn the Keon-Woong Moon's processR package which you can install by simply:

install.packages("processR")

following some examples from the documentation, I have scraped an example together:

labels=list(X="frame",W="skeptic",Y="donate")
moderator=list(name='skeptic',site=list(c("c")))
model=tripleEquation(labels=labels,moderator=moderator,data=disaster,mode=1)
drawConcept(labels=labels, moderator=moderator, drawbox=TRUE)
semfit=sem(model=model,data=disaster,se="boot",bootstrap=200)
modSummary(semfit)
                                       

However the modSummary functions returns NULL. I would appreciate if you could help me understand where is my mistake and how I can solve it.


Solution

  • In your call to model the parameter you want to define is called rangemode not mode. The following will generate a model, and modSummary will no longer be NULL:

    library(processR)
    library(lavaan)
    
    labels = list(X = "frame", W = "skeptic", Y = "donate")
    moderator = list(name = 'skeptic', site = list(c("c")))
    model = tripleEquation(
      labels = labels,
      moderator = moderator,
      data = disaster,
      rangemode = 1
    )
    drawConcept(labels = labels,
                moderator = moderator,
                drawbox = TRUE)
    semfit = lavaan::sem(
      model = model,
      data = disaster,
      se = "boot",
      bootstrap = 200
    )
    modSummary(semfit)
    
    Inference for the Moderation Effects
    ==================================================== 
                          Moderation Effect          
                       c1+c3*W = 0.679-0.171*W       
                 --------------------------------------- 
     skeptic(W)   estimate    95% Bootstrap CI     p     
    ---------------------------------------------------- 
          1.350       0.449  -0.026 to  0.941    .065 
          3.378       0.103  -0.171 to  0.491    .545 
          5.406      -0.244  -0.694 to  0.373    .333 
    ==================================================== 
                                 boot.ci.type:bca.simple