Question: Patient data analysis ( numerical and categorical values) in R
0
gravatar for jansha.1997
6 weeks ago by
jansha.19970 wrote:

Hey everyone. I have a dataset comprising of patient data and their biochemical test results. I have numerical variables and categorical variables like YES/No. I want to run numerical tests like Annova and others into this data set. But I also have categorical variables with values like ( Mother, father, both and none). I have used boolean values to imply the Yes/No values but I don't know what to do with categorical variables with more than binary values and more than 2 values. And I am confused on how to run numerical tests for those? Please help me out.

data analysis R biostatistics • 144 views
ADD COMMENTlink written 6 weeks ago by jansha.19970

What question are you trying to answer? Running some sort of regression on the data using all the predictor variables might be a better approach.

ADD REPLYlink written 6 weeks ago by rpolicastro3.2k

The tests are basically to find the difference between 2 cohorts. And I have made 2 subsets of each cohort from the whole data but I don't know how to recode the categorical variables with more than 3 types of values to numericals. For eg: Normal and abnormal I could recode by 0 and 1 but values like mother, father, both, I don't know how to recode them to numerical to run the test.

ADD REPLYlink written 6 weeks ago by jansha.19970
1

If you only have two cohorts you could try a logistic regression that includes all of your variables. In R you can leave categorical values as characters or an ordered factor.

Having a unified regression model is generally better anyway, because it tests for each variable while holding the other variables constant.

ADD REPLYlink modified 6 weeks ago • written 6 weeks ago by rpolicastro3.2k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2287 users visited in the last hour