<?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: How to determine the df in macro NLEstimate in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-determine-the-df-in-macro-NLEstimate/m-p/408056#M21246</link>
    <description>&lt;P&gt;As noted in the NLEstimate macro description of the DF= option: "&lt;SPAN&gt;The degrees of freedom for testing a linear combination of parameters in a linear model would typically be the number of observations used in fitting the model minus the number of parameters estimated in the model – essentially, the error degrees of freedom."&amp;nbsp; So for your example with 120 observations and a single binary predictor resulting in two model parameters being estimated, you could use 118 degrees of freedom. But note that large sample Wald statistics are often used, as they are in procedures like GENMOD, which are chi-square with 1 df. So, you could get the Wald statistic as (estimate/stderr)**2 and its p-value is 1-probchi((estimate/stderr)**2, 1) .&amp;nbsp; At df as large as 118, you probably won't see much difference in the two p-values.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Oct 2017 14:34:19 GMT</pubDate>
    <dc:creator>StatDave</dc:creator>
    <dc:date>2017-10-27T14:34:19Z</dc:date>
    <item>
      <title>How to determine the df in macro NLEstimate</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-determine-the-df-in-macro-NLEstimate/m-p/407705#M21224</link>
      <description>&lt;P&gt;I'd like to use a public available SAS macro "NLEstimate" to calculate the adjusted rate difference between treated and untreated groups, and I'm having trouble in the "DF" element&amp;nbsp;in &lt;FONT face="Arial" size="2"&gt;NLEstimate&amp;nbsp;macro.&lt;/FONT&gt;&amp;nbsp; I looked at some examples online but it's getting more confusing, especially for the following two examples:&lt;/P&gt;&lt;P&gt;Example1: sample size=180, one discrete variable for treated vs. untreated, and one continuous variable "dose."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; It's DF in&amp;nbsp; &lt;FONT face="Arial" size="2"&gt;NLEstimate&amp;nbsp;macro &lt;/FONT&gt;is 14.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Link: &lt;A href="http://support.sas.com/kb/44/354.html" target="_blank"&gt;http://support.sas.com/kb/44/354.html&lt;/A&gt;, the section about "&lt;STRONG&gt;&lt;EM&gt;Using the NLEstimate macro&lt;/EM&gt;&lt;/STRONG&gt;".&lt;/P&gt;&lt;P&gt;Example2: sample size=6, one discrete variable for&amp;nbsp;age groups (age group1 vs. age group 2), and one continuous variable "car."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; It's DF in&amp;nbsp; &lt;FONT face="Arial" size="2"&gt;NLEstimate&amp;nbsp;macro &lt;/FONT&gt;is 6.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Link:&lt;A href="http://support.sas.com/kb/44/354.html" target="_blank"&gt;http://support.sas.com/kb/44/354.html&lt;/A&gt;. the section about "&lt;STRONG&gt;&lt;EM&gt;Using the NLEstimate macro&lt;/EM&gt;&lt;/STRONG&gt;".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my dataset, I have one binary outcome, one categorical variable (treated vs. untreated), and age as either a continuous or discrete variables(e.g. young vs. old age groups), and a total of 120 observations.&lt;/P&gt;&lt;P&gt;I'd like to calculate the rate difference between the treated and untreated which&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;without any adjustment.&lt;/P&gt;&lt;P&gt;2. with age adjustment when age is treated as a continuous variable&lt;/P&gt;&lt;P&gt;3. with age adjustment when age is treated as a&amp;nbsp;discrete variable, young vs. old.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;My question is how to decide the df when using the &lt;FONT face="Arial" size="2"&gt;NLEstimate&amp;nbsp;macro&lt;/FONT&gt;&amp;nbsp; ?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's part of my SAS code for 1. (I got the df=2 somewhere, not sure if it is right. )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; poissonrate(var);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;data dat1;&lt;/P&gt;&lt;P&gt;set dat;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;if d2_&amp;amp;var ne &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; then log_&amp;amp;var._years = log(d2_&amp;amp;var/&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;365.25&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;else if d2_&amp;amp;var = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; then log_&amp;amp;var._years = log(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;/&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;365.25&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;proc genmod data = dat1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;CLASS treatment;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT size="2"&gt;model &amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" size="2"&gt;var&lt;/FONT&gt;&lt;FONT size="2"&gt; = treatment/ dist=poisson offset = log_&amp;amp;var._years;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT size="2"&gt;estimate &lt;/FONT&gt;&lt;FONT color="#800080" size="2"&gt;'Estimated Rate'&lt;/FONT&gt;&lt;FONT size="2"&gt; intercept &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2"&gt;/ exp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;store out=insmodel;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT color="#000080" size="2"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT size="2"&gt;%&lt;STRONG&gt;&lt;I&gt;poissonrate&lt;/I&gt;&lt;/STRONG&gt;(outcome1&lt;/FONT&gt;&lt;FONT size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT size="2"&gt;%&lt;STRONG&gt;&lt;I&gt;NLEstimate&lt;/I&gt;&lt;/STRONG&gt;(instore=insmodel, label=Rate Difference, f=exp(b_p1+b_p2)-exp(b_p1), df=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" size="2"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="2"&gt;&lt;FONT face="courier new,courier"&gt;/&lt;/FONT&gt;*for rate difference*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;(&lt;FONT size="2"&gt;NLEstimate&amp;nbsp;macro can be found: the download tab on &lt;A href="http://support.sas.com/kb/58/775.html" target="_blank"&gt;http://support.sas.com/kb/58/775.html&lt;/A&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&lt;FONT size="2"&gt;Thanks a lot!&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 16:24:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-determine-the-df-in-macro-NLEstimate/m-p/407705#M21224</guid>
      <dc:creator>agnes12</dc:creator>
      <dc:date>2017-10-30T16:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine the df in macro NLEstimate</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-determine-the-df-in-macro-NLEstimate/m-p/408056#M21246</link>
      <description>&lt;P&gt;As noted in the NLEstimate macro description of the DF= option: "&lt;SPAN&gt;The degrees of freedom for testing a linear combination of parameters in a linear model would typically be the number of observations used in fitting the model minus the number of parameters estimated in the model – essentially, the error degrees of freedom."&amp;nbsp; So for your example with 120 observations and a single binary predictor resulting in two model parameters being estimated, you could use 118 degrees of freedom. But note that large sample Wald statistics are often used, as they are in procedures like GENMOD, which are chi-square with 1 df. So, you could get the Wald statistic as (estimate/stderr)**2 and its p-value is 1-probchi((estimate/stderr)**2, 1) .&amp;nbsp; At df as large as 118, you probably won't see much difference in the two p-values.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 14:34:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-determine-the-df-in-macro-NLEstimate/m-p/408056#M21246</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2017-10-27T14:34:19Z</dc:date>
    </item>
  </channel>
</rss>

