Think of it this way: for a standard sample size calculation, you need four values - a t value for the alpha level, a t value for the beta level (1-power), a measure of the variance and the difference you want to consider as "significant" (effect size). From those you can solve for a sample size, or for a known sample size, calculate the expected power.
For a two sample generalized model, you have to consider the dependence of the variance on the mean for almost every distribution, so it gets a bit harder. Still, you can calculate sample size for a given power, or power given a sample size. The %NLest and %NLmeans macros come in handy for this.
For a repeated measures linear mixed model, there are multiple variance measures, with associated covariances, that need to be taken into account, in addition to the t for alpha, t for beta and detectable difference. The first four sections of the chapter on power determination in SAS for Mixed Models address this approach, which happens to be the simplest I have seen for mixed models. Note that for generalized mixed models, this method remains valid, as it builds the mean to variance relationship in, but the detectable difference has to be expressed on the linked scale, rather than the original scale, and this is a non-trivial exercise.
Consequently, almost every sample size or power determination using a generalized linear mixed model for things like clinical trials uses simulation. This is a case where tools like IML (linked to R or not) or Viya (using R or Python) can utilize existing packages that live out there on the internet to do the simulation.. And if you are a much better programmer than I am, I am sure that a combination of IML and DATA step programming could be constructed as well.
One work around would be to consider a single contrast (2 group design) for a narrow inference space (totally fixed effects, nothing repeated) analysis. This will give an estimate of sample size that is too small, as the variance for a broad inference space is generally greater than for a narrow inference space. However, that estimate can be multiplied by a rule of thumb (I use 2x) to get a conservative estimate of the sample size needed to detect the difference of interest. You could use this estimate in any costing algorithm dependent on sample size to get a maximum probable cost for a study to declare a difference significant at the alpha=0.05 at least (1 - beta) percent of the time.
Steve Denham.
... View more