DATA Step, Macro, Functions and more

Proc logistic: p-value

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

Proc logistic: p-value

The purpose of our study is to compare our results of minimum dietary diversity for women during 2 seasons: spring and summer.

We want to check if the number of women who achieve dietary diversity is different between spring and summer and if the number of women who do not achieve minimum dietary diversity is different between spring and summer.

We want to create a table like this:

 

Minimum dietary diversity

spring

summer

p-value

No

......%

.....%

 

Yes

......%

.....%

 

 

We used a proc logistic to take into account the confounding variables:

proc logistic data = results2;

Class Land_acces (param=ref ref='No')

region (param=ref ref='1-South')

v_urban_rural (param=ref ref='rural')

season (param=ref ref='spring')

model MDD_W (event='Yes')=

Land_acces

region

season;

v_urban_rural

Land_acces * season

region * season

v_urban_rural * season

format season saison. ;

run;

image.png

 

This proc logistic gave us just one p-value for both seasons!!

How can I obtain the p-value for women who achieve minimum dietary diversity and women who do not while taking into account the confounding variables?


Accepted Solutions
Solution
‎04-08-2018 06:03 PM
Respected Advisor
Posts: 2,650

Re: Proc logistic: p-value

I don't understand. You asked about season, which is not a dependent variable in the model you show.

 

LSMEANS always gives you the mean value of the DEPENDENT variable, split by one (or more) of the independent variables.

 

Contrasts are never needed when you are comparing a level of a variable to another level of the same variable.

--
Paige Miller

View solution in original post


All Replies
Respected Advisor
Posts: 2,650

Re: Proc logistic: p-value

Occasional Contributor
Posts: 13

Re: Proc logistic: p-value

Posted in reply to PaigeMiller

Yes, I know and it was really helpful Thank you. But last time I asked about the independent variables and this time I wanted to do the same thing for the dependent variable. For the other question I used contrast instead of LSMEANS to obtain my results and it worked but not for the dependant variable in both seasons!!

 

I used this Code :

proc logistic data = results2;

Class

Land_acces (param=ref ref='Non')

region (param=ref ref='1-Sud')

v_urban_rural (param=ref ref='rural')

season (param=ref ref='spring');

model MDD_W(event='Yes')=

Land_acces

region

v_urban_rural

Land_acces * season

region * season

v_urban_rural * season

season/ expb;

 

 contrast 'region = 1-Sud season summer vs spring' region 0 0 season 1  /  estimate = exp ;

 contrast  'region = 2-GAE season summer vs spring' region 1 0 season 1  / estimate  = exp;

 contrast  'region = 3-GAO season summer vs spring' region 0 1 season 1  / estimate  = exp;

 

 contrast  'v_urban_rural = rural season summer vs spring' v_urban_rural 0 season 1  / estimate  = exp;

 contrast  'v_urban_rural = urban season summer vs spring' v_urban_rural 1 season 1  / estimate  = exp;

 

 

 contrast  'Land_acces = Non season summer vs spring' Land_acces 0 season 1  / estimate  = exp;

 contrast  'Land_acces = Wi season summer vs spring' Land_acces 1 season 1  / estimate  = exp;

 

 

 contrast 'summer v spring' season 0  / estimate  = exp;

 contrast 'summer v spring' season 1  / estimate  = exp;

 

format season saison.;

TITLE'COMP MDD_W PRINTEMPS ÉTÉ';

run;

 

I tried to add the code in red to answer my question but it didn't seem to work !!

 

Will it work with LSMEAN for the dependent variable ???

 

Solution
‎04-08-2018 06:03 PM
Respected Advisor
Posts: 2,650

Re: Proc logistic: p-value

I don't understand. You asked about season, which is not a dependent variable in the model you show.

 

LSMEANS always gives you the mean value of the DEPENDENT variable, split by one (or more) of the independent variables.

 

Contrasts are never needed when you are comparing a level of a variable to another level of the same variable.

--
Paige Miller
Occasional Contributor
Posts: 13

Re: Proc logistic: p-value

Posted in reply to PaigeMiller

Thank you so much for all your answers. I just need to confirm one last thing if you don't mind...

As I said in my post: https://communities.sas.com/t5/Base-SAS-Programming/Proc-logistic-p-value/td-p/452359

I want to create a table like this: So I thought I need 2 p-values to compare people from the 2 rows: women who achieved dietary diversity during both seasons and women who didn't during both seasons.

 

Minimum dietary diversity

spring

summer

p-value

No

76.79%

79.03%

 .......

Yes

23.21%

20.97%

 ......

 

By using LSMEANS I got only one p-value for the variable season (spring/summer)  so my question is what can I do to create the table I want?

 

this is the code I used :

 

proc logistic data = results2;
Class
terres_acces (param=ref ref='Non')
region (param=ref ref='1-Sud')
v_urban_rural (param=ref ref='rural')
season (param=ref ref='spring');
model MDD_W_5(event='Oui')=
terres_acces
region
season
v_urban_rural
terres_acces * season
region * season
v_urban_rural * season/ expb;
lsmeans terres_acces * season
region * season
v_urban_rural * season / lines;
format season saison.;
run;

image.png

Respected Advisor
Posts: 2,650

Re: Proc logistic: p-value

[ Edited ]

@sebai wrote:

 

I want to create a table like this: So I thought I need 2 p-values to compare people from the 2 rows: women who achieved dietary diversity during both seasons and women who didn't during both seasons.

 

Minimum dietary diversity

spring

summer

p-value

No

76.79%

79.03%

 .......

Yes

23.21%

20.97%

 ......

 

 


Again, this isn't making sense. What model term is: "women who achieved dietary diversity during both seasons and women who didn't during both seasons". What term in the model tells us if the women achieved dietary diversity during both seasons or not??? Specifically, what numbers in the table shown do you want to compare?

--
Paige Miller
Occasional Contributor
Posts: 13

Re: Proc logistic: p-value

[ Edited ]
Posted in reply to PaigeMiller

@PaigeMiller

I want to compare:

  • Minimum dietary diversity=NO in spring and Minimum dietary diversity=NO in summer (compare 76% and 79%)

Minimum dietary diversity

spring

summer

p-value

No

76.79%

79.03%

………..

 

And then do another comparison:

  • Between Minimum dietary diversity=Yes in spring and Minimum dietary diversity=Yes in summer

Minimum dietary diversity

spring

summer

p-value

Yes

23.21%

20.97%

 

 

The minimum dietary diversity (MDD) is another variable that I created in my programme:

MDD =

MDD_W_1_grains_root_tuber +

MDD_W_2_pulses +

MDD_W_3_nuts_seeds +

MDD_W_4_dairy +

MDD_W_5_meat_fish +

MDD_W_6_eggs +

MDD_W_7_leafy_veg +

MDD_W_8_vit_a_veg_fruit +

MDD_W_9_other_veg +

MDD_W_10_other_fruit;

 

IF MDD < 5 THEN MDD_W_5 = "No";

IF MDD GE 5 THEN MDD_W_5 = "Yes";

Respected Advisor
Posts: 2,650

Re: Proc logistic: p-value


@sebai wrote:

@PaigeMiller

I want to compare:

  • Minimum dietary diversity=NO in spring and Minimum dietary diversity=NO in summer (compare 76% and 79%)

Minimum dietary diversity

spring

summer

p-value

No

76.79%

79.03%

………..

 

And then do another comparison:

  • Between Minimum dietary diversity=Yes in spring and Minimum dietary diversity=Yes in summer

Minimum dietary diversity

spring

summer

p-value

Yes

23.21%

20.97%

 

 


No, you don't want to do this. If you know the values for "Yes", you also know the values for "No". This is only a single comparison.

 

Since the logistic regression output shows season with a p-value of 0.2984, the difference between 23.21% in spring and 20.97% in summer is not a statistically significant difference.

 

 

--
Paige Miller
☑ This topic is solved.

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

Discussion stats
  • 7 replies
  • 165 views
  • 2 likes
  • 2 in conversation