# Identifying risk factors in a study

I have a dataset of patients who have been inpatients (admitted to hospital) and not admitted (but visited as outpatients). Class proportion is 66:34.

I have collected a list of features for all these patients.

Now my objective is to find/identify the risk factors that leads to hospital admission? Meaning what are the risk factors that can influence a patient to be admitted? How the risk factors are different between two classes? For example patient with High heart rate or some sensitive clinical parameter(just example) could get admitted whereas person with normal clinical paramters may not get admitted but visit only for consulation.

Can you confirm whether my steps below are right?

2) Around 25 input variables

3) Run a logistic regression (Statsmodel logit or Scikit-learn?)

4) Do we always have to predict the outcome class to know the risk factors that lead to admission/hospitalization?

5) Then identify the significant risk factors based on p-value.

Though my objective is to identify the risk factors that leads to hospital admission, do I still have to predict the outcome class to know the risk factors?

Since this sounds like an approach for binary classification, how do I know that the risk factors that I get is only for "hospital admission class"? Does it mean the risk factors are always only for one class (which I choose to set as 1 (hospital admission)?

Your question is a bit disjointed, so I'll offer a few thoughts in a similarly scattershot fashion.

First, to the distinction you're making between "predict the outcome class" and "know the risk factors," the only way to get to the latter is through the former. A risk factor is just a feature that helps us assess the risk of something, and in binary classification, the "something" is the outcome of interest. So we can only reliably identify risk factors by trying to predict (or really just sort or classify) the cases and seeing which features help us do that the best.

Second, in binary classification, it does not matter which class you choose as the reference class. The results will be the same either way, so it's mostly about making it easier to interpret and present the results the way you'd like.

Third and related, in binary classification, any factor that helps you predict one class ipso facto helps you predict the other. You aren't trying to assess risks of two different and potentially unrelated outcomes; you are trying to sort cases according to the presence or absence of a single outcome. So it's a zero-sum situation, and risk factors relate to both classes inversely.

Fourth, p-values offer one way to identify important risk factors, but they aren't the only way. In fact, p-values can be poor guides to predictive power---see this paper for one discussion and illustration of why---and if you're talking about "risk factors," that's probably what you really care about. Instead of p-values, you could use cross-validation to see which features provide the most predictive power alone and in combination, or use something like LASSO regression or Bayesian model averaging to partially automate that search.

Fifth, you mentioned the proportions of outcomes in your sample, but you didn't say anything about sample size, and that should be an important factor in your choice of methods. If you have data describing hundreds or thousands of cases, you've got a lot of options. If you only have dozens of cases, however, you'll need to keep it much simpler.

Last but not least, in your situation, it's really important to make sure that measurement of any variables you include in the analysis occurred before the decision on whether or not to admit the patient. Otherwise, you've got an endogeneity problem that will likely bias your results in unhelpful ways.

• Hi, thanks for the response. Upvoted. However I have another quick question. My class proportion is 66:33% (3436:1768) (after removing duplicate subjects). my real data has multiple outpatient (not admitted) classes for each subject. ex: I might visit hospital multiple times as an outpatient for consultation. Should I pick any random one? On what basis should I choose the one? – The Great Feb 3 at 8:56
• It's really hard to say without knowing more about your topic and data. Do you only have one observation per admitted patient but multiples per outpatient? If so, knowing why that's true would be important to thinking about how to handle it. If not, then I would look at mixed-effects models with observations grouped by patient and information about patient visit histories added to the mix. – ulfelder Feb 3 at 10:23
• No, I have multiple observations per patient irrespective whether it is inpatient or outpatient – The Great Feb 3 at 10:25
• Yeah, then I would focus on approaches that let you account for the relationship between those observations within patients, e.g., a mixed-effects model with random intercepts for individuals. You can read a technical introduction here and a nice worked example here. That merTools package mentioned in the latter is great for stuff like predictive simulations after modeling. – ulfelder Feb 3 at 10:31