I am planning to run Stan on this model but first of all I need to make sure this model is valid. Hence I tried lmer() first to check the model. Clearly this model is not ideal as one predictor is dropped for its perfect collinearity with the rest predictors.
when analyzed seperately as grouping factors, cut and color both look good in Stan.
But I was just wondering if there is another way to construct the model that could integrates both cut and color as grouping factors? Thank you
It’s great that you are getting into writing statistical models and want to use Stan for it – learning R is also useful to get them working with rstan or cmdstanr, but while many Stan users do use R, many use Python and other languages. Others still, like me, use R less frequently and are used to the old school, base R syntax and have to zone into the kind of pipe syntax that seems to be popular with newer R users.
Either way, the good thing about Stan (and MCMC in general) is that issues like collinearity of predictors will likely show up as correlated samples or issues with the sampling chain itself.
Without knowing further detail, we can say that a model may be valid, but the actual predictors used may be correlated, or otherwise the data may not allow confident inference.
That wouldn’t be a good test of whether the predictors would work well together in a model, if they are correlated, using both could add little information. But once again, the sampling chain could give you more information about what is happening.
That would really depend on what the issue is: how correlated they are, and how that affects inference. For similar syntax, you could probably consider using brms (I vaguely remember there being a stan glmer, but I never used it).