pitakakariki / simr

Power Analysis of Generalised Linear Mixed Models by Simulation
68 stars 19 forks source link

nested random effect #282

Closed JJ-Zhang-DS closed 2 months ago

JJ-Zhang-DS commented 2 months ago

Suppose my model is y~ 1 + x +(1|A/B), where B is nested under A. For the later simulation and power analysis, I can only usealong = B, can NOT do like powerCurve(model, test=fixed("x"), along=A/B)

But how to do the power analysis for the levels of B under A with simr, it think powerCurve(model, test=fixed("x"), along=B) shows the total level of B, not level of B under A.

Thank you.

pitakakariki commented 2 months ago

If it's nested and balanced, along B should be what you need. If you need something more specific then you can adjust your design manually and attach it with getData(model) <- myData.

JJ-Zhang-DS commented 2 months ago

Thanks. Yes, I tested the simulated dataset by getData(model). It does still keep B nested under A.