0

I have been looking around online in regards to R^2 calculations in mixed models and a lot of info has come up in R (lme4, MuMIn) where the lme4 package creates the mixed model fit and MuMIn calculates the two R^2 values that Nakagawa and Schielzeth created,

enter image description here enter image description here

I've tried using rpy2 so I can access these R packages in Python but I have been having trouble getting that to work. Below is my mixed model equation and output.

enter image description here

enter image description here

Ultimately I would like to calculate the correlation of my statistic and win%. After I calculate the R^2 value I can take the square root to get the correlation coefficient. I have an unbalanced repeated measures data set which is why I chose the LMM. The players column is my grouping factor.

The R^2 equations posted above are made up of 3 variance values: the fixed-effects variance, the random variance and the residual variance. Suggestions on how to calculate these mathematically within my data set would be helpful as well. I have 3 columns going into this model [win%, statistic, player]

Thank you

George
  • 1
  • 3
  • Please note that programming questions are off-topic on this site - it maybe a better fit on stackoverflow. – Robert Long Apr 07 '19 at 07:27
  • Also, [this answer](https://stats.stackexchange.com/questions/111150/calculating-r2-in-mixed-models-using-nakagawa-schielzeths-2013-r2glmm-me) may be of some use. – Robert Long Apr 07 '19 at 07:30

0 Answers0