pitakakariki / simr

Power Analysis of Generalised Linear Mixed Models by Simulation
70 stars 20 forks source link

se.fixef() function #106

Open prmar7 opened 6 years ago

prmar7 commented 6 years ago

great package, does exactly what I need.

However, given all the free time you've cleared up for me, I now have more avenues to explore:

We can simulate power for a given effect size with fixef(fit)["a"] <- .2 powerSim(fit, fixed("a","z"))

and I would also like to be able to inflate the estimated standard error of the fixed effect to see how my power is affected, something like: fixef(fit)["a"] <- .2 se.fixef(fit)["a"] <- se.fixef(fit)["a"]*1.2 powerSim(fit, fixed("a","z"))

Maybe there is already a way to do this from the lmer or arm packages that I don't see.

Thanks

pitakakariki commented 6 years ago

If you're using lmer, you could increase the residual s.d. with sigma<-, which will indirectly increase standard errors.

If it's glmer, then you could use an observation-level random effect, which can be modified with VarCorr<-.

There's a help page for the various modification functions at ?modify.