Rank deficiency in fixed-effect model

I am using stan_lmer function from rstanarm packages. I am getting an error saying fixed-effect model matrix is rank deficient so dropping 1 column / coefficient.
Since I am passing the informative priors in the function so due to dropped column in matrix, the size of priors gets differ.

I need help in identifying the dropped columns so that I can adjust the priors vector to make the code run.

Code I ma using is as following -

model <- stan_lmer(F1,data = x,
                             prior = normal(
location = c(mean(x$elasticity),rep(0,length(unique(x$ZONE_ID))-1),0,0,0.3,
                                                         rep(0,length(unique(x$Week_wrap))-1),
                                                         rep(0,length(unique(x$ZONE_ID))-1),0.3,0.3),
                                            scale = c(lpv,rep(2.5,length(unique(x$ZONE_ID))-1),2.5,1,0.1,
                                                      rep(2.5,length(unique(x$Week_wrap))-1),
                                                      rep(1.5,length(unique(x$ZONE_ID))-1),0.2,0.2),
                                            autoscale = FALSE), 
                             seed = seed_num, algorithm = method_c,iter = num_iter,QR = TRUE)
1 Like

Hi,
sorry for not getting to you earlier. I would ask @jonah or other rstanarm experts to verify, but I think that when you run with QR = TRUE, the fixed effects matrix is transformed and the coefficients of the model don’t directly correspond to your predictors, so I am not sure using informative priors in combination with QR = TRUE is sensible.

I think the easiest way to find out which columns get dropped is to run the model without the priors (possibly for just a few iterations) and see which coefficient is missing in the summary.

Best of luck with the model!