<?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: Using a covariate in Proc Glimmix in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/324690#M17147</link>
    <description>&lt;P&gt;Stacy, you might find this exchange interesting.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;built a nice example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A title="Should I use &amp;quot;Offset&amp;quot; or add a &amp;quot;rate&amp;quot; variable in the data set for Poisson regression?" href="https://communities.sas.com/t5/SAS-Statistical-Procedures/Should-I-use-quot-Offset-quot-or-add-a-quot-rate-quot-variable/td-p/324342" target="_self"&gt;https://communities.sas.com/t5/SAS-Statistical-Procedures/Should-I-use-quot-Offset-quot-or-add-a-quot-rate-quot-variable/td-p/324342&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Jan 2017 20:15:09 GMT</pubDate>
    <dc:creator>sld</dc:creator>
    <dc:date>2017-01-13T20:15:09Z</dc:date>
    <item>
      <title>Using a covariate in Proc Glimmix</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/322237#M17040</link>
      <description>&lt;P&gt;I am testing&amp;nbsp;if tree density differs in response to a&amp;nbsp;treatment using Proc Glimmix with a negative binomial distribution. I would like to use a covariate of tree density prior to treatment in the model. Are there any diagnostics I should be using to test if my covariate should be transformed?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 20:17:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/322237#M17040</guid>
      <dc:creator>StacyClark</dc:creator>
      <dc:date>2017-01-03T20:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using a covariate in Proc Glimmix</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/322290#M17044</link>
      <description>&lt;P&gt;The generalised linear mixed model framework of proc glimmix fundamentally encompasses covariates that would not meet otherwise necessary gaussian distributional assumptions in an ordinary least squares model framework.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is not the same however as asserting that a transformation on a covariate will not improve overall model fit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this interests you, you could still usefully explore covariate transformations in the spirit of the latter, and using the proximity of the scale factor (chi sq/df) to unity, and/or with method=laplace you could compare the AICCs or -2LLs of models with competing covatiate transformations and/or also higher order polynomial terms to see if there is a minimisation on one or more particular transformations.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 00:25:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/322290#M17044</guid>
      <dc:creator>Damien_Mather</dc:creator>
      <dc:date>2017-01-04T00:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using a covariate in Proc Glimmix</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/322303#M17047</link>
      <description>&lt;P&gt;Stepping back a bit: Is "tree density" a count (i.e., does "tree density" take integer values)? Typically, density is a rate: count/area. Is&amp;nbsp;area the same for all experimental/observational units? I'm pondering here whether the negative binomial distribution is your best choice.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If tree density is a count (and now for clarity, I'll refer to "tree density" as "tree count"), then a negative binomial distribution might be appropriate. The canonical link for the negative binomial distribution is the log. Unless you invoke a curvilinear (e.g., quadratic) model, the relationship between the response and the covariate is assumed to be linear in the GLIMMIX procedure (generalized &lt;EM&gt;linear&lt;/EM&gt; mixed model), which roughly translates into a linear relationship between log(post-tree-count) and the covariate (noting of course, that a log transformation of post-tree-count is not the same as a log link). Logically, I then would consider a log transformation of pre-tree-count. Plot log(post-tree-count) against log(pre-tree-count) and visually assess the relationship. Does it look linear? You can color- or symbol-code points by other predictor variable values as well for (potentially) additional insight.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 02:42:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/322303#M17047</guid>
      <dc:creator>sld</dc:creator>
      <dc:date>2017-01-04T02:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using a covariate in Proc Glimmix</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/322393#M17050</link>
      <description>&lt;P&gt;Thanks for your responses. I will try various transformations of the covariate&amp;nbsp;to see if it improves overall model fit and to assess the visual relationship between the covariate and the y variable in the&amp;nbsp; model.&lt;/P&gt;&lt;P&gt;I used the NB distribution because the Poisson distribution had major overdisperssion problems. I had also tried log transforming the y variable and using a gaussian model, but that did not fix the normality problems.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 14:01:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/322393#M17050</guid>
      <dc:creator>StacyClark</dc:creator>
      <dc:date>2017-01-04T14:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using a covariate in Proc Glimmix</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/322400#M17051</link>
      <description>&lt;P&gt;The y variable was density (trees per hectare), taken on fixed radius plots of the same size. Data were collected as counts, then transformed to density using the plot size.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 14:23:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/322400#M17051</guid>
      <dc:creator>StacyClark</dc:creator>
      <dc:date>2017-01-04T14:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using a covariate in Proc Glimmix</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/322458#M17052</link>
      <description>&lt;P&gt;I'll ask, because it's a not-uncommon misconception: Are you checking normality using the observed data combined over treatment groups or using the residuals from a model? The former approach is bad, the latter approach is good. Distributional assumptions are conditional on the predictor variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something of an aside: If the number of trees is "big enough", the Poisson distribution can be approximated by a normal distribution. Even if the data within each treatment group are normally distributed, the treatment groups could have different variances. Unequal variances might be accommodated with a log transformation or a heterogeneous variances model, as well as other approaches. So a model invoking a normal distribution might work, or it might not, depending on the data. If the counts are substantially overdispersed, then a model based on normal distributions might be less likely to be satisfactory.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 18:27:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/322458#M17052</guid>
      <dc:creator>sld</dc:creator>
      <dc:date>2017-01-04T18:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using a covariate in Proc Glimmix</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/322461#M17053</link>
      <description>&lt;P&gt;Theoretically, density data cannot follow a negative binomial distribution because density data do not take integer values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unlike (at least some) packages in R, the GLIMMIX procedure accepts non-integer data in conjunction with the negative binomial distribution and appears to deliver valid results.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That said, my preference for modeling density based on counts is to use an offset (which is the third model in the code below). This approach is particularly advantageous if, say, plot areas are variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dpost: post-treatment density&lt;/P&gt;
&lt;P&gt;dpre: pre-treatment density&lt;/P&gt;
&lt;P&gt;npost: post-treatment count&lt;/P&gt;
&lt;P&gt;npre: pre-treatment count&lt;/P&gt;
&lt;P&gt;_log: log transformation&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;title1 "Using density with negative binomial distribution";
proc glimmix data=have method=laplace;
    nloptions tech=nrridg;
    class trt;
    model dpost = dpre_log trt dpre_log*trt / dist=negbin;
    lsmeans trt / ilink;
    output out=glmm_out pred=pred student=student;
    run;
proc sgplot data=glmm_out;
    loess x=dpre_log y=student;
    refline 0 / axis=y;
    run;


title1 "Using count with negative binomial distribution";
proc glimmix data=have method=laplace;
    nloptions tech=nrridg;
    class trt;
    model npost = npre_log trt npre_log*trt / dist=negbin;
    lsmeans trt / ilink;
    output out=glmm_out pred=pred student=student;
    run;
proc sgplot data=glmm_out;
    loess x=npre_log y=student;
    refline 0 / axis=y;
    run;


title1 "Using count with negative binomial distribution with offset to obtain density";
proc glimmix data=have method=laplace;
    nloptions tech=nrridg;
    class trt;
    model npost = npre_log trt npre_log*trt / dist=negbin offset=area_log;
    lsmeans trt / ilink;
    output out=glmm_out pred=pred student=student;
    run;
proc sgplot data=glmm_out;
    loess x=npre_log y=student;
    refline 0 / axis=y;
    run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 18:45:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/322461#M17053</guid>
      <dc:creator>sld</dc:creator>
      <dc:date>2017-01-04T18:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using a covariate in Proc Glimmix</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/323447#M17101</link>
      <description>&lt;P&gt;My understanding is that normality should be checked with residuals from the model.&lt;/P&gt;&lt;P&gt;I had initially tried a Gaussian distribution, but normality was a major problem that was not overcome with transformation. A Poisson distribution had major overdispersion problems.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 19:21:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/323447#M17101</guid>
      <dc:creator>StacyClark</dc:creator>
      <dc:date>2017-01-09T19:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using a covariate in Proc Glimmix</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/323451#M17102</link>
      <description>&lt;P&gt;Thanks for your help with this. The plots were all the same size, so density and counts should yield similar results.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 19:25:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/323451#M17102</guid>
      <dc:creator>StacyClark</dc:creator>
      <dc:date>2017-01-09T19:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using a covariate in Proc Glimmix</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/324690#M17147</link>
      <description>&lt;P&gt;Stacy, you might find this exchange interesting.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;built a nice example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A title="Should I use &amp;quot;Offset&amp;quot; or add a &amp;quot;rate&amp;quot; variable in the data set for Poisson regression?" href="https://communities.sas.com/t5/SAS-Statistical-Procedures/Should-I-use-quot-Offset-quot-or-add-a-quot-rate-quot-variable/td-p/324342" target="_self"&gt;https://communities.sas.com/t5/SAS-Statistical-Procedures/Should-I-use-quot-Offset-quot-or-add-a-quot-rate-quot-variable/td-p/324342&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2017 20:15:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Using-a-covariate-in-Proc-Glimmix/m-p/324690#M17147</guid>
      <dc:creator>sld</dc:creator>
      <dc:date>2017-01-13T20:15:09Z</dc:date>
    </item>
  </channel>
</rss>

