Use and calculation of conditional and marginal R2 in generalized additive mixed models In Nakagawa et al. the conditional and marginal R2 are defined for linear mixed models to disentangle the ~variance explained by the fixed and random effects .
Nakagawa, S., Johnson, P. C. D., & Schielzeth, H. (2017). The coefficient of determination R2 and intra-class correlation coefficient from generalized linear mixed-effects models revisited and expanded. Journal of The Royal Society Interface, 14(134), 20170213. doi: 10.1098/rsif.2017.0213
When fitting a generalized additive mixed model (GAMM) via the mgcv package in R with normal errors and identity link, the fit is done via the nlme package here. Is it possible to estimate marginal and conditional R2 for this non linear regression in the same way as for lme, e.g. via the r.squaredGLMM() function from the MuMIn package and if yes why?
Update: What if I rewrite my gam model and use polynomials and lme instead, say
lme(Y~ poly(x1,2):fac+poly(x2,2):fac, random=~1|a/b/d)

does this reduce to:
lme(Y~ I(x1^2):fac+I(x1):fac+I(x2^2):fac+I(x2):fac+fac, random=~1|a/b/d)

so that this reduces to a linear mixed model instead?

You can use the 'r.squaredGLMM' function in the R package 'MuMIn' as it follows:
r.squaredGLMM(your_GAMM_object$lme)
I hope this helps.
Best wishes
