. I would like to study the link between mortality (outcome and binary variable) and competition between hospitals (Predictor). The competition faced by the hospital is measured by the Herfindahl-Hirschmann index (HHI), which is a continuous variable. I have patient-level variables (age, sex, diagnosis, general state of the patient), area (city) level variables (social deprivation index of the city, care offer in the city...), hospital level variables (HHI, public or private status of the hospital, hospital caseload). The last two groups of variables are at a higher level, since I want to make a cross-classified multilevel model (Patients are nested in both hospitals and cities). I'm looking for R scripts to implement the right modele. I have hundred of hospitals et thousand of cities, so I would consider hospitals and area effects as random.
Here's how I plan to proceed:
library lme4 model<- lmer(Death~age+sex+diagnos+patient_stat+ (1|Hospit_ID+HHI+Hospital_stat+HospCaseLoad) + (1|City_ID+Deprivation_index,care offer),data=mydata).
But I'm not sure that the model is well implemented.
Another concern is the travel distance between the patient's city and the hospital where he or she is treated. If I decide to put this variable as level 2, I don't know whether to associate it at hospital level or city level, since not all patients living in the same city are at the same distance from their hospital of care (if they are treated in different hospitals), and this is true in the other way, not all patients treated in the same hospital are at the same distance from this hospital. But, all patients living in the same city and treated in the same hospital will share the same travel distance. Could I consider this variable to be level 1? What are the risks for this?
Should I follow the same steps as a simple model for the selection of variables to put in the model? That is, do bivariate analyses with each fitting variable (apart from the relevant variables) and the outcome? In practice, what are the validity conditions to check for such a model?