For certain subdisciplines of Psychology, sample size calculations using simulated data become increasingly important. For simple(r) scenarios, e.g., ANOVA-like, that is a reasonably straightforward problem. A great example of a more interesting case of univariate Logistic Regression can be found HERE.
More complex cases, like the Generalised Additive Mixed Model with non-linearities, appear to be rather challenging.
Can anyone provide a working example (e.g., an R-script) for a more tame case of the Linear Mixed Model with two covariates both of which would assume polynomials, e.g., poly(..., 3), and at least one random effect?