# Using conditional instrument with different rstanarm models

Does rstanarm allow using instrumental variable (conditional instrument in this case) for making an equivalent analysis to two-stage least squares? How to do it? Possible to do it with different types models, i.e. combining bernoulli, lognormal and survival?

DAG
Z is the conditional instrument when adjusting for P1-P3.

EXPOSURE
X - is a zero-inflated extremely positively skewed continuous variable. Does this 2SLS method allow me to use two models (binomial on all data and lognormal for positive values) in the first phase of analysis or I have to restrict the first phase to one model (binomial only)? In other words, can I go for plan A or B?

Y - is a survival object, including time and status

A
m1 = X ~ Z + P1 + P2 + P3, binomial model (all X values
m2 = X ~ Z + P1 + P2 + P3, lognormal model (positive values of X)
m3 = Y ~ fitted_probability_for_positive_X_values + fitted_positive_X_values + P1 + P2 + P3, survival model

B
m1 = X ~ Z + P1 + P2 + P3, binomial model (all X values
m2 = Y ~ fitted_probability_for_positive_X_values + P1 + P2 + P3, survival model

Rstanarm seemed not to have a lognormal family, can I combine brms and rstanarm models or they are too different things?

Everything that helps to proceed is really welcome.

1 Like

Hi,
good question! I am not very knowledgeable about instrumental variable models, but since nobody else answered, I will give it a try.

I donâ€™t think `rstanarm` is capable of anything similar. `brms` might be, but it is not completely straightforward, nor completely clear whether it is possible. (Basically anything that can be done in `rstanarm` can be done in `brms`, but `brms` is a bit harder to install).

I particularly think that resusing the â€śfitted_probability_for_positive_X_valuesâ€ť in multiple submodels might be a problem (sharing coefficients across multiple formula is scheduled for the future brms 3.0). It also might be just surmountable with clever use of non-linear syntax, but it will definitely be a challenge.

In any case, the model seems rather complex, so I would definitely first try simpler submodels and see if you can a) implement them and b) have enough data to inform all of the parameters. Only once you are sure that simpler model works should you add more complexity.

Some links on building IV models in `brms` that will hopefully help:

Instrumental Variables model in brms? Discusses some limitations, but I am not usre if those werenâ€™t lifted in later `brms` versions.

In all cases, be aware that you are likely moving at a somewhat wild territory and it is likely not a lot of people have tried to express a model like yours before (either in `brms` or pure Stan). Especially the survival part is potentially quite tricky as the Bayesian versions of survival models are IMHO somewhat underexplored for potential modelling difficulties. You are thus likely to encounter challenges :-)

Feel free to ask if the links donâ€™t provide the info you need or have additional concerns/inquiries.

Best of luck with the model!