BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bripetersen
Calcite | Level 5

Hi all. I am having a hard time and was hoping that someone could help me with the code I need to use for my exact logistic regression test? First, is my data file set up correctly? I am testing the yes/no (binary) presence of skeletal stress against military service length of a sample of 29 decedents. In column A I have Years (this is active years of military service) and column B has a 0 or a 1 where 0 means no and 1 means yes. If this is correct, how would I set up my code? I have tried looking up examples and mimicking that but am not having the best luck and am not the most confident after doing that. It appears that I need three columns of data unless I'm just looking at examples that are too different from what my data is. If I need to set up my data a little differently, please let me know. For example, should column A have the years and then column B have the quantity of yes and column C have the quantity of no rather than each person getting their own data row? I am happy to provide any other info upon request. Thank you in advance. 

 

YearsPorosity
00
11
11
11
11
11
11
10
11
11
11
10
11
11
21
21
21
21
31
31
31
31
51
60
121
191
191
211
251
1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

This is just a simple logistic model. You can always use individual level data like this, but alternative response syntax is available if the data is aggregated into counts like you mentioned. You don't really need exact estimation since the default asymptotic method seems to converge to a proper solution. You can add the EXACT statement if you really want, but the results are similar. 

proc logistic;
model porosity(event="1")=years;
run;

View solution in original post

7 REPLIES 7
bripetersen
Calcite | Level 5

@StatDave - you helped me a lot on my last post so maybe you have some input? Many thanks in advance 

StatDave
SAS Super FREQ

This is just a simple logistic model. You can always use individual level data like this, but alternative response syntax is available if the data is aggregated into counts like you mentioned. You don't really need exact estimation since the default asymptotic method seems to converge to a proper solution. You can add the EXACT statement if you really want, but the results are similar. 

proc logistic;
model porosity(event="1")=years;
run;
bripetersen
Calcite | Level 5
My research told me that I should use exact logistic regression because my sample size is so small - is that not the case? Thanks so much - my first time using this test and my first time using SAS, I usually use R! Appreciate it
sbxkoenk
SAS Super FREQ

Hello,

 

Performing Exact Logistic Regression with the SAS System — Revised 2009
Robert E. Derr, SAS Institute Inc., Cary, NC

https://support.sas.com/rnd/app/stat/papers/exactlogistic2009.pdf

 

Exact Logistic Regression and Exact Poisson Regression
https://support.sas.com/rnd/app/stat/topics/exact/exact.htm

 

Exact Methods
https://support.sas.com/rnd/app/stat/topics/exact-methods.html

 

Koen

bripetersen
Calcite | Level 5
Thank you! I've already read all of these and was still a little confused. The examples aren't exactly what my test is so I was having a hard time translating it. I am not a statistician if you can't tell haha
Ksharp
Super User
Also you could use FIRTH option to instead of EXACT test.

proc logistic;
model porosity(event="1")=years/ firth ;
run;
StatDave
SAS Super FREQ
There is nothing wrong with using the exact method, but it often isn't necessary. It is clearly needed if a very small sample size or sparseness of the data cause problems with the default asymptotic estimation. But otherwise the exact method usually produces more conservative results than the asymptotic method. So if, as in this case, the p-value(s) of interest are not significant (such as >0.15) then the results from the exact method are not likely to change much. For more, see the book by Stokes et. al. (2012), Categorical Data Analysis Using the SAS System.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 649 views
  • 7 likes
  • 4 in conversation