## Heterogeneity test for multinomial logistic regression

Solved
Occasional Contributor
Posts: 14

# Heterogeneity test for multinomial logistic regression

Good day:

I'm wondering how I can test for a trend across outcome categories in multinomial logistic regression? I have four different durations of breastfeeding and several different predictor variables and I would like a p-value for trend for each predictor.

Here is my code:

surveylogistic data=final;

ebf (ref='5.5-6.5')  hs_q01 (Ref='english OR FRENCH or other') supplement (ref='yes')prenat (Ref='lo') rigon (ref='two') ;

weight weight_ch;

strata community;

run;

I've tried a test statement, but I can't seem to get the code to run.  Any help is greatly appreciated.

Accepted Solutions
Solution
‎04-10-2012 11:48 AM
Posts: 5,540

## Re: Heterogeneity test for multinomial logistic regression

Try a simplified program first:

proc surveylogistic data=final;

class hs_q01(ref='1');

model ebf(ref='1') = hs_q01 / glogit;

test intercept = intercept1;

run;

and see if that will work. We can then build from there.

PG

PG

All Replies
Posts: 5,540

## Re: Heterogeneity test for multinomial logistic regression

K, your code didn't copy too well (known problem...). I'm assuming proc, class and model statements. From the doc, seems like the test statement should read :

Hetero: test intercept = intercept1 = intercept2 = intercept3;

What message do you get?

PG

PG
Occasional Contributor
Posts: 14

## Re: Heterogeneity test for multinomial logistic regression

Yes.  Proc, class, and model statements.  Thanks for catching that cut and paste error, PG.

I was able to deduce that the appropriate code was what you provided: test intercept: intercept1=intercept2=intercept3 but I'm not sure how I can re-code my variables so that SAS recognizes that 'intercept1' is, say the intercept of hs_q01 for EBF duration 1 and intercept 2 is the intercept of hs_q01 EBF duration 2.  I'm getting the error message that the variable is not in my model, which is what I expected.  Is this because i've used class statements instead of dummy variables?

I was thinking of outputting my intercepts into another database and then re-running the code, but my SAS/statistics knowledge is a bit lacking.

Posts: 5,540

## Re: Heterogeneity test for multinomial logistic regression

K, I am not clear as to what you want exactly. Your model statement relates ebf to supplement only. Your other variables hs_q01, prenat and rigon are NOT in the model. Mentionning them in a CLASS statement merely informs SAS of their categorical nature and reference level. It does not include them in your model. In the test statement I proposed (that's an equal sign after intercept) there is one intercept for each level of your outcome variable. Try it also without intercept4, I'm not sure its needed.

Good luck.

PG

PG
Occasional Contributor
Posts: 14

## Re: Heterogeneity test for multinomial logistic regression

Thanks PG.  That was careless - of course hs_q01 isn't in the model I pasted.    Are you saying my code should look like this?

proc surveylogistic;

class ebf (ref='1')  hs_q01 (ref='1');

model ebf=hs_q01/glogit;

weight weight_ch;

strata community;

test intercept1=intercept2   OR

test hs_q011=hs_q012?

run;

This isn't running.  I don't have an 'intercept1, 2 etc' or a hs_q011 in my model that I've defined.  Right?

Solution
‎04-10-2012 11:48 AM
Posts: 5,540

## Re: Heterogeneity test for multinomial logistic regression

Try a simplified program first:

proc surveylogistic data=final;

class hs_q01(ref='1');

model ebf(ref='1') = hs_q01 / glogit;

test intercept = intercept1;

run;

and see if that will work. We can then build from there.

PG

PG
Occasional Contributor
Posts: 14

## Re: Heterogeneity test for multinomial logistic regression

So, I tried the codes today on a diferent data set and they worked!  Thanks for the help.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
• 6 replies
• 1281 views
• 0 likes
• 2 in conversation