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?

HERE is a similar question, without an answer. Also, I found THIS about sample size calculation for the Generalised Linear Mixed Model.

  • 2
    $\begingroup$ Why would this not be realistically doable? I think this is a wonderful requirement. Yes, you would need to think beforehand about functional forms, relationships and models - and I would argue that forcing people to do so is a Good Thing. See Sample size calculation for univariate logistic regression. Can you explain where you see a problem? $\endgroup$ Jul 31, 2022 at 11:35
  • $\begingroup$ Hi Stephan Kolassa, I do not think the idea is without its own problems, i.e., it's a particular "strategy" that has consequences. I don't think it is a magical solution, which some people assume. What is the point of this exercise if the nature of the analysis is exploratory? For confirmatory: sure! Let me turn the question back, and help me understand: what is so wonderful with that requirement? Why is that such a Good Thing? Thanks! $\endgroup$
    – striatum
    Jul 31, 2022 at 15:41
  • 1
    $\begingroup$ Are you asking about whether it's a Good Thing to require a power analysis or sample size calculation? Or are you fine with this requirement and are just asking why I like simulations to do so? (Note that either one is different from your question as posted, which is whether this is doable in the first place.) $\endgroup$ Jul 31, 2022 at 15:53
  • $\begingroup$ To be honest, I am curious to learn. So, all answers are welcome. Besides, I would be able to understand the mechanics of this (lacking such particular experience) if I would see the code even with a simple(r) lmer with, e.g., one or two polynomials. So, random effects plus poly(..., 2) or poly(..., 3). This is not at all tradition in my area, and the way they are asking this appears to be a new dogma. Simple ANOVA-like or even (logistic) regression: fine. But random effect and non-linearities... gosh... But, again, open to learning more. $\endgroup$
    – striatum
    Jul 31, 2022 at 17:01
  • $\begingroup$ Can you decide which question you would like to see addressed, and edit your post to clarify? We like to have one question per post here, which makes it easier to answer without duplicating parts of posts elsewhere. $\endgroup$ Jul 31, 2022 at 18:54


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.