1

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.

Foad S. Farimani
  • 12,396
  • 15
  • 78
  • 193

1 Answers1

2

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
Greg
  • 3,570
  • 5
  • 18
  • 31
  • Thanks a lot. Would you be kind also to explain what is the difference between `mode` and `rangemode` here and why the later should be used in this case? – Foad S. Farimani Feb 19 '20 at 21:47
  • BTW how di you get that nice table? – Foad S. Farimani Feb 19 '20 at 21:52
  • 1
    I'd love to give you an answer where I sound real smart, but sadly what I did here is read the documentation in ```?modSummary``` where the package author gives an example exactly like the one you did, except uses ```rangemode``` instead of ```mode```. The documentation for ```tripleEquation``` rather unhelpfully only defines ```mode``` as {a number} with a default of 0. – Greg Feb 19 '20 at 21:56
  • 1
    The table though is easy to answer - that's the output of ```modSummary(semfit)```, as it prints into the console in RStudio. – Greg Feb 19 '20 at 21:57
  • OK, I'm using Jupyter and the table I'm getting is nothing similar. The `mode` parameter I think regards to the Andrew F. Hayes. PROCESS method/algorithm. you may use `sort(pmacro$no)` to see all modes and `pmacroModel()` to draw them – Foad S. Farimani Feb 19 '20 at 22:02
  • RStudio is much nicer. Thanks! – Foad S. Farimani Feb 19 '20 at 22:25