I have cross-sectional data for the Diabetes group. I am trying to test a model the predicts a specific complication “ Cataract”(i.e., a dependent variable which is an ordinal variable) by other health complications i.e., independent variables which could be nominal, ordinal, and scale variables.
As the data is cross-sectional, in this case, I think that I don’t need to use any code to prepare the data for analysis, I mean I should use the below code:
The first question:
I have an independent variable that consists of two groups in the same column, where the first group named type 1 while the second group named type 2. So, in this case: what is the code to test that:
The second question:
Let us assume that the model that I want to use is the following model, and please remember that my main aim is to predict a specific complication “ Cataract”. So, the model is:
Where the Cataract is ordinal variable.
Gender is nominal variable
Age is ordinal
Diabetes duration is scale.
So, I think that I should use the ordinal logistic regression, and the code I think for this will be:
But I need to see the relationship between each of the independent variable with the dependent variable, for instance, the effect of Gender on all levels of Cataract, so I think the code will be:
So could you please correct me if any of the above codes are not correct?
The third question:
I am very interested in finding whether the component of gender I mean male and female have different predictions on the dependent variable or not, if yes could you please tell me the code.
Many thanks in advance
As the data is cross-sectional, in this case, I think that I don’t need to use any code to prepare the data for analysis, I mean I should use the below code:
Code:
ge id= _n encode patient, gen(PATIENT)
I have an independent variable that consists of two groups in the same column, where the first group named type 1 while the second group named type 2. So, in this case: what is the code to test that:
The second question:
Let us assume that the model that I want to use is the following model, and please remember that my main aim is to predict a specific complication “ Cataract”. So, the model is:
Code:
Cataract= Gender + Age + Diabetes duration
Gender is nominal variable
Age is ordinal
Diabetes duration is scale.
So, I think that I should use the ordinal logistic regression, and the code I think for this will be:
Code:
Ologit Cataract Gender Age Diabetes_duration, r
Code:
margins, dydx ( Gender) marginsplot
The third question:
I am very interested in finding whether the component of gender I mean male and female have different predictions on the dependent variable or not, if yes could you please tell me the code.
Many thanks in advance