Hi everyone,
I'm looking into the rjmcmc model selection method implemented in Nimble. Here, I want to consider a model that includes a quadratic form of a covariates, and I want the quadratic form to be included only when the main effect is in. I have the following line to achieve that (the full code is attached in case anyone is interested):
y_pred[i] <- beta0 + z[1] * beta1 * x1[i] + z[2] * beta2 * x2[i] + z[2] * z[3] * beta3 * x2[i] * x2[i]
which seems to work fine. However, meanwhile I figured there is this requirement that the length of beta's has to be the same as the length of z's. Say I want the main effect and the quadratic form to be in or out at the same time, what should I do? I cannot have the following:
y_pred[i] <- beta0 + z[1] * beta1 * x1[i] + z[2] * beta2 * x2[i] + z[2] * beta3 * x2[i] * x2[i]
Is there a way to overcome this?
Best,
Qing