06-05-2018 08:49 PM - edited 06-05-2018 09:09 PM
Hi, I am running a logistic regression model from an excel dataset, where each patient has multiple rows with information, so the Patient, Cancer, and Gender column are always the same, but the therapy column has different values. Like this example below:
Patient Cancer Gender Therapy
1 Y F 234
1 Y F 234
1 Y F 555
2 N M 444
2 N M 777
I'm trying to run a logistic regression where it doesn't count the multiple observations and only counts Patient 1 as 1 observation. It's been messing with my numbers and I'm not sure how to fix it.
This is how I usually code in proc logistic:
Proc logistic data=Data;
class Gender (ref="M") /param=ref;
model Disease (ref="N")= gender;
06-05-2018 09:50 PM
I've been looking up certain ways of doing this, and I found SAS pdf's that mentioned using Patient ID's as a repeated measure. Does anyone know how that would work with logistic regression?
06-05-2018 10:36 PM
to answer your first question, it would be wasteful to discard data but if there's some reason for using the first obs for each patient you can reduce the data set using "proc sort data=data nodupkey; by patient; run;"
you're right, however, with your second post, ie you likely want to use the repeated values for each patient. We would need to know more about the design of the study, eg the order the treatments were received, what exactly the outcome is etc. A cross over design is not uncommon and is maybe analogous. You can likely find SAS code examples online for a binary outcome. Note that you would not use proc logistic, in that case. Maybe you use proc nlmixed or genmod: https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_intromix_a0...
06-05-2018 10:47 PM
Thank you so much for responding to my thread. I've been playing around with Proc Glimmix, and it seems to be working fine, do you think this would be a better way of doing it over Proc Genmod?
PROC GLIMMIX DATA=Data;
CLASS ID Gender (ref= "M");
MODEL Disease (ref="N") = Gender /DIST=binary oddsratio;
RANDOM INTERCEPT /SUBJECT=ID TYPE=UN;
06-05-2018 11:43 PM
but you don't have therapy in your model. Isn't that the most important thing? You seem to be interested in gender, but surely therapy is more likely to influence patient outcomes? It depends on why the study was designed, the objective and hypotheses etc. Personally, I'm not too familiar with glimmix, i used it many years ago when it was just a macro sas hadn't fully released. I would tend to use nlmixed. Glimmix v nlmixed is an interesting discussion tho : http://www2.sas.com/proceedings/forum2007/179-2007.pdf
06-05-2018 11:09 PM
How many therapies do you have? I feel like transposing the data and using dummy variables/one hot encoding makes sense as well here since none of the other data changes across rows?
It would become:
Patient Cancer Gender Therapy_234 Therapy_555 Therapy_444 Therapy_777
1 Y F 1 1 0 0
2 N M 0 0 1 1
This would also make sense if you have a baseline therapy you're comparing to.
06-06-2018 12:16 AM - edited 06-06-2018 12:18 AM
The number of patients doesn't matter (edit: to the question I asked), the number of therapies do.
Do you have the number of therapies?
You can use PROC TRANSPOSE to transpose your data and then create the 0/1's as necessary. The code is simple and we can help with that, but the methodology is more important first.
06-06-2018 12:25 AM
Ok, I don't think either way is going to matter, you have too many variables and too little observations - the general rule is 25-30 obs per variable. And since Therapy has 20 levels that'll be too complex. Not sure if the NLMIXED is appropriate. I'm going to move this to the stats forum so some people smarter than me can answer it
Need further help from the community? Please ask a new question.