Closed xiaoransun closed 5 years ago
That paper's begind a paywall and I don't have access to it. Could you please email a copy to the email address on the cran page? https://cran.r-project.org/web/packages/simr/
Thanks for quick reply, Peter!
Sorry I didn't realize you wasn't accessible to the paper. Just sent!
Even not with the simulation R code, but with my own lmer
model, I actually got the same error message as well.
I tried to reinstall lme4
on my R but the error message still occurs.
My guess is that instead of:
sim.ef <- powerSim(model, fixed("x", "kr"), alpha=alpha.S, nsim=10)
You've typed:
sim.ef <- powerSim(model, fixed("x", "kr"), alpha.S, nsim=10)
I double checked my code and it was sim.ef <- powerSim(model, fixed("x", "kr"), alpha=alpha.S, nsim=10)
(I didn't miss the alpha=
part).
Do you think it could be due to my R version (3.5.0)?
The error message seems to indicate something wrong with the simulate
function. Therefore I tried the source code of this package where this function was called:
simulate( object, newparams=simParams, newdata=simData, family=family(object), weights=w)[[1]]
And it ran well, actually.
Did I miss any other places where the package (especially the powerSim
) function calls simulate
?
I ran the code from the paper and it works fine. R version shouldn't matter, 3.5.0 is very recent.
Maybe copy your script into the comments and I'll see if I can spot anything.
I just realized what it is now-- a really silly spot.
Problem is I exactly copied the code from the paper: sim.ef <- powerSim(model, fixed("x", "kr"), alpha=alpha.S, nsim=1,000)
And there is this evil comma 1,000
. 🤷♀️
Hope nobody else would get caught up in it.
Thanks so much! I really appreciate your time and help.
Yep, journals are awful at formatting code!
Hi,
I've been trying to replicate the procedure in the Arend & Schäfer (2019) Psych Methods paper, especially the R codes at Table 3.
However, by exactly following the R codes, the
powerSim
still cannot work, returning the warning messageThis appears to be an "observed power" calculation
. And further, usinglastResult()$errors
, I got the error message:no applicable method for 'simulate' applied to an object of class "c('double', 'numeric')"
Strange enough, is that when I tried using
simulate
anddoSim
on the simulated lmer model, there was no error message.Could you tell why that was? Any thoughts would be appreciated!