<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: HPLogistic: Odds Ratio Plot with Wald Chi-Square p-values in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/HPLogistic-Odds-Ratio-Plot-with-Wald-Chi-Square-p-values/m-p/757871#M36886</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/155173"&gt;@SAS_Rob&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do I necessarily need the covariance matrix for Odds ratio confidence intervals? I thought it was just necessary for calculating the Wald Chi-Square and p-value. I'm still trying to wrap my head around writing an equation to calculate the standard error if I had the covariance.&amp;nbsp; (aside from knowing that proc logistic has the covb option)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stats.stackexchange.com/questions/418231/how-does-sas-compute-standard-error" target="_blank" rel="noopener"&gt;https://stats.stackexchange.com/questions/418231/how-does-sas-compute-standard-error&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stats.idre.ucla.edu/sas/seminars/analyzing-and-visualizing-interactions/" target="_blank" rel="noopener"&gt;https://stats.idre.ucla.edu/sas/seminars/analyzing-and-visualizing-interactions/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I noticed that hplogistic allows for typing COV in the procedure statemennt...."proc HPLogistic data=neuralgia COV;"&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What does COV do?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Jul 2021 18:35:59 GMT</pubDate>
    <dc:creator>PharmlyDoc</dc:creator>
    <dc:date>2021-07-28T18:35:59Z</dc:date>
    <item>
      <title>HPLogistic: Odds Ratio Plot with Wald Chi-Square p-values</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/HPLogistic-Odds-Ratio-Plot-with-Wald-Chi-Square-p-values/m-p/757710#M36882</link>
      <description>&lt;P&gt;The question of calculating a Wald Chi-Square test has been asked in the past, but I didn't see a complete answer.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a large dataset of over 150,000 rows and 12 columns, and I am using HPLogistic,&amp;nbsp;but HPLogistic does not have an option for an oddsratio plot.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to create an odds ratio plot with a table of ORs, 95% CI, and Wald Chi-Square p-values on the right of the plot.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used this a resource for calculating the Wald Chi-Square:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/kb/53/376.html" target="_blank" rel="noopener"&gt;https://support.sas.com/kb/53/376.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My question is if the methodology I am using to calculate odds ratios, 95% CI, and Wald Chi-Square p-values from the HPLogistic parameterestimates table is correct? (exponentiating the parameter estimates)&lt;/P&gt;
&lt;P&gt;I am using the neuralgia dataset as an example. First with proc logistic, then with HPLogistic to compare.&amp;nbsp;For this example I am not using a selection technique.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Neuralgia;
input Treatment $ Sex $ Age Duration Pain $ @@;
datalines;
P  F  68   1  No   B  M  74  16  No  P  F  67  30  No
P  M  66  26  Yes  B  F  67  28  No  B  F  77  16  No
A  F  71  12  No   B  F  72  50  No  B  F  76   9  Yes
A  M  71  17  Yes  A  F  63  27  No  A  F  69  18  Yes
B  F  66  12  No   A  M  62  42  No  P  F  64   1  Yes
A  F  64  17  No   P  M  74   4  No  A  F  72  25  No
P  M  70   1  Yes  B  M  66  19  No  B  M  59  29  No
A  F  64  30  No   A  M  70  28  No  A  M  69   1  No
B  F  78   1  No   P  M  83   1  Yes B  F  69  42  No
B  M  75  30  Yes  P  M  77  29  Yes P  F  79  20  Yes
A  M  70  12  No   A  F  69  12  No  B  F  65  14  No
B  M  70   1  No   B  M  67  23  No  A  M  76  25  Yes
P  M  78  12  Yes  B  M  77   1  Yes B  F  69  24  No
P  M  66   4  Yes  P  F  65  29  No  P  M  60  26  Yes
A  M  78  15  Yes  B  M  75  21  Yes A  F  67  11  No
P  F  72  27  No   P  F  70  13  Yes A  M  75   6  Yes
B  F  65   7  No   P  F  68  27  Yes P  M  68  11  Yes
P  M  67  17  Yes  B  M  70  22  No  A  M  65  15  No
P  F  67   1  Yes  A  M  67  10  No  P  F  72  11  Yes
A  F  74   1  No   B  M  80  21  Yes A  F  69   3  No
;
run;

proc logistic data=Neuralgia plots(only maxpoints=none)=(
		ODDSRATIO(logbase=10 TYPE=HORIZONTALSTAT)) namelen=30  ;
         class Treatment(ref='P') Sex(ref='F') / param=ref;
         model Pain = Treatment Duration Sex Age Sex*Age
/ clodds=wald orpvalue;
		 oddsratio treatment / cl=wald diff=ref ;
		 oddsratio Duration / cl=wald diff=ref;
         oddsratio Sex / cl=wald diff=ref;	
		 oddsratio Age / cl=wald diff=ref;
         ods output parameterestimates=logistic_paramest;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PROC Logistic: Odds Ratios with 95% confidence intervals" style="width: 716px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61941i1587B0D3949798F9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-07-28 at 8.55.34 AM.png" alt="PROC Logistic: Odds Ratios with 95% confidence intervals" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;PROC Logistic: Odds Ratios with 95% confidence intervals&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, with HPLogistic, I outputted the parameterestimates and exponentiated Estimate, Lower, and Upper to calculate the odds ratios (plot) and 95% CI. And used Estimate and StdErr to calculate the WaldCHISQ and p-values.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc hplogistic data=neuralgia  ;
class Treatment(ref='P') Sex(ref='F') / param=ref;
model Pain = Treatment Duration Sex Age Sex*Age
/ cl association ctable=roc  link=logit lackfit rsquare; 
ods output parameterestimates=HPLogistic_paramest;
run;
quit;


data HPLogistic_paramest_OR;
set HPLogistic_paramest;
OddsRatioEst = exp(Estimate);
LowerCL = exp(Lower);
UpperCL = exp(Upper);
run;

data HPLogistic_paramest_OR_Wald;
set HPLogistic_paramest_oddsratios;
waldchisq=((Estimate)/StdErr)**2;
pvalue=1-probchi(waldchisq,1);
run;

PROC SQL;
DELETE FROM HPLogistic_paramest_OR_Wald
WHERE Parameter in ('Intercept');
quit;

proc format;
value $parameterfmt 
'Treatment A' = 'Treatment A vs P'
'Treatment B' = 'Treatment B vs P'
'Age' = 'Age at Sex=F'
'Age*Sex M'= 'Age at Sex=M'; 
run;


title "HPLogistic: Odds Ratios with 95% Confidence Limits and Wald Chi-Square p-values";
proc sgplot data=HPLogistic_paramest_OR_Wald noautolegend;
   scatter y=Parameter x=OddsRatioEst / xerrorlower=LowerCL xerrorupper=UpperCL
           markerattrs=(symbol=diamondfilled);
   refline 1 / axis=x;
   xaxis grid type=log label="Odds Ratio (log scale)";  /* specify log scale */
   yaxis grid display=(nolabel) discreteorder=data reverse;
yaxistable OddsRatioEst LowerCL UpperCL pvalue / location=inside
position=right ;
format Parameter $parameterfmt.;  
run;






&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt; &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ods output  parameterestimates with exponentiated Estimate as OddsRatioEst, Lower as LowerCL, and Upper as UpperCL. waldchisq and pvalue are also calculated from Estimate and StdErr  where by  waldchisq=((Estimate)/StdErr)**2; pvalue=1-probchi(waldchisq,1);" style="width: 925px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61948i353AFD808CED3E6F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-07-28 at 9.23.49 AM.png" alt="ods output  parameterestimates with exponentiated Estimate as OddsRatioEst, Lower as LowerCL, and Upper as UpperCL. waldchisq and pvalue are also calculated from Estimate and StdErr  where by  waldchisq=((Estimate)/StdErr)**2; pvalue=1-probchi(waldchisq,1);" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;ods output  parameterestimates with exponentiated Estimate as OddsRatioEst, Lower as LowerCL, and Upper as UpperCL. waldchisq and pvalue are also calculated from Estimate and StdErr  where by  waldchisq=((Estimate)/StdErr)**2; pvalue=1-probchi(waldchisq,1);&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="proc sgplot: Odds Ratio plot created from HPlogistic_paramest_OR_Wald table" style="width: 646px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61949i2F0FBA2A5A53787D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-07-28 at 10.14.22 AM.png" alt="proc sgplot: Odds Ratio plot created from HPlogistic_paramest_OR_Wald table" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;proc sgplot: Odds Ratio plot created from HPlogistic_paramest_OR_Wald table&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Notice that the&amp;nbsp; "Age at Sex=M" odds ratio and 95% CI in the HPLogistic OR plot is different than that of the proc logistic OR plot - is the interaction still calculated at the mean of the continuous variable? Also, the HPLogistic OR plot is missing the "Sex M vs F at Age=70.05" – how do I compute this in HPLogistic?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 14:35:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/HPLogistic-Odds-Ratio-Plot-with-Wald-Chi-Square-p-values/m-p/757710#M36882</guid>
      <dc:creator>PharmlyDoc</dc:creator>
      <dc:date>2021-07-28T14:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: HPLogistic: Odds Ratio Plot with Wald Chi-Square p-values</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/HPLogistic-Odds-Ratio-Plot-with-Wald-Chi-Square-p-values/m-p/757717#M36883</link>
      <description>&lt;P&gt;Because of the interaction, you will not get the odds ratios by simply exponentiating the parameter estimates.&amp;nbsp; You would need to include the continous variable set at its mean value.&amp;nbsp; You are essentially setting it at 0 by ignoring the interaction effect.&lt;/P&gt;
&lt;P&gt;This usage note might be helpful as well.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/kb/24/455.html" target="_blank"&gt;https://support.sas.com/kb/24/455.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 14:42:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/HPLogistic-Odds-Ratio-Plot-with-Wald-Chi-Square-p-values/m-p/757717#M36883</guid>
      <dc:creator>SAS_Rob</dc:creator>
      <dc:date>2021-07-28T14:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: HPLogistic: Odds Ratio Plot with Wald Chi-Square p-values</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/HPLogistic-Odds-Ratio-Plot-with-Wald-Chi-Square-p-values/m-p/757789#M36884</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/155173"&gt;@SAS_Rob&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Setting age to its mean?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc logistic has the "At option" for the oddsratio statement: "odds ratio age /at(Age=70) cl=odds;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So how do I calculate the odds ratio for Sex M vs F at Age=70 using the estimates from HPLogistic?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 16:29:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/HPLogistic-Odds-Ratio-Plot-with-Wald-Chi-Square-p-values/m-p/757789#M36884</guid>
      <dc:creator>PharmlyDoc</dc:creator>
      <dc:date>2021-07-28T16:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: HPLogistic: Odds Ratio Plot with Wald Chi-Square p-values</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/HPLogistic-Odds-Ratio-Plot-with-Wald-Chi-Square-p-values/m-p/757868#M36885</link>
      <description>&lt;P&gt;It isn't really possible to get the CL from HPLOGISTIC.&amp;nbsp; The issue is that while you can compute the point estimate for the OR which would simply be:&lt;/P&gt;
&lt;P&gt;exp(LB) where LB is b6+70.05*b7 and b6 is the estimate for age and b7 is the estimate for the interaction&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you would not be able to get a standard error directly since HPLOGISTIC does not produce a table with the covariance matrix for the parameter estimates.&amp;nbsp; Without the standard error you would not be able to compute the CL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 18:25:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/HPLogistic-Odds-Ratio-Plot-with-Wald-Chi-Square-p-values/m-p/757868#M36885</guid>
      <dc:creator>SAS_Rob</dc:creator>
      <dc:date>2021-07-28T18:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: HPLogistic: Odds Ratio Plot with Wald Chi-Square p-values</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/HPLogistic-Odds-Ratio-Plot-with-Wald-Chi-Square-p-values/m-p/757871#M36886</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/155173"&gt;@SAS_Rob&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do I necessarily need the covariance matrix for Odds ratio confidence intervals? I thought it was just necessary for calculating the Wald Chi-Square and p-value. I'm still trying to wrap my head around writing an equation to calculate the standard error if I had the covariance.&amp;nbsp; (aside from knowing that proc logistic has the covb option)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stats.stackexchange.com/questions/418231/how-does-sas-compute-standard-error" target="_blank" rel="noopener"&gt;https://stats.stackexchange.com/questions/418231/how-does-sas-compute-standard-error&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stats.idre.ucla.edu/sas/seminars/analyzing-and-visualizing-interactions/" target="_blank" rel="noopener"&gt;https://stats.idre.ucla.edu/sas/seminars/analyzing-and-visualizing-interactions/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I noticed that hplogistic allows for typing COV in the procedure statemennt...."proc HPLogistic data=neuralgia COV;"&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What does COV do?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 18:35:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/HPLogistic-Odds-Ratio-Plot-with-Wald-Chi-Square-p-values/m-p/757871#M36886</guid>
      <dc:creator>PharmlyDoc</dc:creator>
      <dc:date>2021-07-28T18:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: HPLogistic: Odds Ratio Plot with Wald Chi-Square p-values</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/HPLogistic-Odds-Ratio-Plot-with-Wald-Chi-Square-p-values/m-p/757872#M36887</link>
      <description>&lt;P&gt;In the absence of any statements like LSMEANS or LSMESTIMATE, you could explore the CODE statement.&amp;nbsp; According to the documentation, it writes DATA step code to a file that can be used to calculate predicted values (probabilities).&amp;nbsp; If you have that code, then you can plug in the values for which you want predicted probabilities, which could then be used to get ORs.&amp;nbsp; I suspect it will not easily give you a standard error, so Wald chi-squares might take more coding.&amp;nbsp; But if you have a predicted probability, you can calculate the variance using well-known formulas, and from there get the denominator as a function of a sum of the variances.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 18:34:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/HPLogistic-Odds-Ratio-Plot-with-Wald-Chi-Square-p-values/m-p/757872#M36887</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2021-07-28T18:34:06Z</dc:date>
    </item>
  </channel>
</rss>

