BookmarkSubscribeRSS Feed
mw2939
Calcite | Level 5

I'm doing a proc logistic and trying to figure out how to determine the frequencies of each variable used in my final model. The output tells me the number of observations read, but is there a way to know how the 'n' of each variable in my multivariate model? 

4 REPLIES 4
ddemilla
Fluorite | Level 6

If I am understanding this question correctly, you want to know how many observations are used for each variable of your model. I believe the answer is the same for all variables and will be the one that you already have. If a given value is missing for a single variable, then even if there is data for the other variables, the entire observation will be dropped from the model calculations. So any observation with missing values for variables included in your model will be dropped. You should look into handling missing data so that you can fill these missing values before hand with imputed values. 

 

Best of luck,

Daniel

mw2939
Calcite | Level 5

Hmm I included the code below and specified that observations are dropped for the variables in the model. However, I've seen tables in many publications where the 'n' is listed for variables in unadjusted and adjusted models. And the variables in the adjusted models have different 'n' values. 

 

 

proc logistic descending data=meley.burum7; /*MODEL 1*/

model exclusive=        mbmi /*keep*/

                        childage /*keep*/

                        primi /*keep*/

 

                        /*married not_married_partner*/

                        /*dailyincome2*/

                                    Q38_Borrowed_money_from_others

                                    /*Read_or_Write*/

                                    Lib_lessthan8 Lib_morethan8 Gha_zone1112 /*ACC: Time living in Ghana with 4 groups*/

                                  mom_age;

 

where exclusive ne . and mbmi ne . and childage ne . and primi ne . and marital_status_model2 ne . and dailyincome2 ne .

and Read_or_Write ne . and Q38_Borrowed_money_from_others ne . and acc25_timeinghana ne . and mom_age ne . ; run;

Reeza
Super User
That would mean that your cohort isn't the same across your analysis which implies unfair model comparisons to me. I could be wrong of course...
ddemilla
Fluorite | Level 6

The problem is that if a record is missing observations, then comparing it to those that are not is like comparing apples and oranges. For example, if you are predicting exclusive and have trained your model and found that both childage and primi are very influential in predicting exclusive. Then if you have one observation that has records for both childage and primi and one record that is missing a value for primi, then it would be inconsistent to use the same model to predict both records. This has to do with the fact that when you are calculating model coefficients, you are finding the impact of any independent variable on the dependent variable while holding all other independent variables constant. If you don't have those other variables (due to missing values), then really what you have is a completely different model e.g. y=x_1+x_2 vs. y=x_1. So the 'n' or number of observations for your model should be the same for all variables used in your model. I am not sure what you have seen in other publications, perhaps they were running multiple experiments with different cohorts and then comparing them? By default, SAS will drop any observations with missing values that are used in the model for this reason. I hope that helps.

 

Best,

Daniel 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 964 views
  • 1 like
  • 3 in conversation