<?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 Negative binomial in IML, and rounding error difficulties when computing GINV (and thus SVD) in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Negative-binomial-in-IML-and-rounding-error-difficulties-when/m-p/26192#M116</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks very much for your reply.&amp;nbsp; I'm hoping I can feel my way through this...&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 10pt;"&gt;The neqative binomial (NB) model should have a parameter, k, so I don't think your formula is correct.&lt;/SPAN&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 10pt;"&gt; &lt;/SPAN&gt; &lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;Typically, yes, I agree.&amp;nbsp; However, when the REPEATED statement is used in GENMOD (invoking the GEE), ML estimates of the scale (or dispersion for NegBin) disappear, perhaps into the "nuisance" variation associated with the clustering?&amp;nbsp;&amp;nbsp; If k is required, however, I don't have any idea how to get ML estimates of it in IML?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 10pt;"&gt;As best we can tell, &lt;/SPAN&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;the macro writer is using the following definitions for a model with link function g():&lt;/SPAN&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #1f497d; font-size: 10pt;"&gt; &lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #1f497d; font-size: 10pt;"&gt;Ui: mean&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Fui: ginv(mean), i.e. linear predictor&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Fui_dev: diagonal matrix of weights for Fisher scoring = 1/(v(mu)*dg(mu)**2) (not sure about this one: gamma has negative sign?)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Vui: diagonal matrix of inverse of square root of variance.&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;Agree in Ui and Fui.&amp;nbsp; I'll have to defer to you on the others, although the negative sign in the gamma confused me as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #1f497d; font-size: 10pt;"&gt;If these are right, for a log-linked NB with dispersion parameter k, you might try&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #1f497d; font-size: 10pt;"&gt;Ui = xi*beta&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Fui = log(ui)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Fui_dev = diag(ui/(1+k*ui))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Vui = diag( 1/sqrt(ui+k*ui##2)) &lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;Tried it, and understandably it's looking for a matrix "k".&amp;nbsp; I'll run it by the other forum as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 10pt;"&gt;For your second question, I'm away from my office, so can't reproduce the error. Perhaps when you correct specify the NB model, this second error will go away. Or someone else might be able to help.&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;Alas, no.&amp;nbsp; It's not specific to the NegBin, but occurs with other distributions (e.g., Poisson) as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;BR /&gt;Adam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Jan 2012 02:49:33 GMT</pubDate>
    <dc:creator>AdamSmith</dc:creator>
    <dc:date>2012-01-10T02:49:33Z</dc:date>
    <item>
      <title>Negative binomial in IML, and rounding error difficulties when computing GINV (and thus SVD)</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Negative-binomial-in-IML-and-rounding-error-difficulties-when/m-p/26190#M114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm trying to extend the following macro (from Peter Song, Univ Michigan; &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www-personal.umich.edu/~pxsong/qif_package/QIFv02.sas"&gt;http://www-personal.umich.edu/~pxsong/qif_package/QIFv02.sas&lt;/A&gt;&lt;SPAN&gt;), which fits a quadratic inference function (QIF; a type of marginal generalized linear model akin to generalized estimating equations), to accommodate a negative binomial distribution.&amp;nbsp; The macro is not too long, but I won't copy it here since I've provided a link.&amp;nbsp; Fair warning: I'm brand spanking new the world of IML, so (1) please pardon my ignorance, and (2) it's okay to let me know I'm in over my head...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem 1:&amp;nbsp; Implementing a negative binomial distribution QIF&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proposed solution: The negative binomial application should be similar to the Poisson except for the specification of the variance function.&amp;nbsp; Thus, in every place where a Poisson distribution is referenced in the macro, I've added a new section corresponding to the NEGBIN.&amp;nbsp; These sections are identical in all cases (e.g., the calculation of pearson and deviance residuals, the calculation of ui) except in how the variance function is defined.&amp;nbsp; For the Poisson, this particular section of the macro looks like this:&lt;/P&gt;&lt;P&gt;&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; %else %if &amp;amp;dist = POISSON&amp;nbsp; %then %do;&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; ui = exp( (xi*beta) );&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; fui = log(ui);&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; fui_dev = diag(ui);&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; vui = diag(sqrt(1/ui));&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; %end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think it should look like this for NB:&lt;/P&gt;&lt;P&gt;&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; %else %if &amp;amp;dist = NEGBIN %then %do;&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; ui = exp( (xi*beta) );&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; fui = log(ui);&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; fui_dev = diag(ui)*diag(1+ui);&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; vui = diag(sqrt(1/ui))*diag(sqrt(1/(1+ui)));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem 2: Rounding errors preclude calculation of SVD and GINV&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proposed solution: ???&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some (hopefully) relevant log output...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: No convergence of singular value decomposition due to rounding errors.&lt;/P&gt;&lt;P&gt;ERROR: Execution error as noted previously. (rc=100)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;operation : GINV at line 5471 column 1&lt;/P&gt;&lt;P&gt;operands&amp;nbsp; : arsumc&lt;/P&gt;&lt;P&gt;arsumc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30 rows&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30 cols&amp;nbsp;&amp;nbsp;&amp;nbsp; (numeric)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;statement : ASSIGN at line 5471 column 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've attached a *.SAS file containing the modified macro, my data, and the particular QIF call that produced the above error.&amp;nbsp; I used the Poisson in this call to avoid any potential errors in my adaptation to the negative binomial...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks very much for any help,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Adam Smith&lt;/P&gt;&lt;P&gt;Department of Natural Resources Science&lt;/P&gt;&lt;P&gt;University of Rhode Island&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2012 04:03:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Negative-binomial-in-IML-and-rounding-error-difficulties-when/m-p/26190#M114</guid>
      <dc:creator>AdamSmith</dc:creator>
      <dc:date>2012-01-09T04:03:37Z</dc:date>
    </item>
    <item>
      <title>Negative binomial in IML, and rounding error difficulties when computing GINV (and thus SVD)</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Negative-binomial-in-IML-and-rounding-error-difficulties-when/m-p/26191#M115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 10pt;"&gt;The neqative binomial (NB) model should have a parameter, k, so I don't think your formula is correct.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 10pt;"&gt;Your first question is statistical, rather than having to do with matrices and linear algebra. I'm not an expert in GEEs or using generalized linear models, but I discussed this with a colleague. As best we can tell, &lt;/SPAN&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;the macro writer is using the following definitions for a model with link function g():&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #1f497d; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #1f497d; font-size: 10pt;"&gt;Ui: mean&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Fui: ginv(mean), i.e. linear predictor&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Fui_dev: diagonal matrix of weights for Fisher scoring = 1/(v(mu)*dg(mu)**2) (not sure about this one: gamma has negative sign?)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Vui: diagonal matrix of inverse of square root of variance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #1f497d; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #1f497d; font-size: 10pt;"&gt;If these are right, for a log-linked NB with dispersion parameter k, you might try&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #1f497d; font-size: 10pt;"&gt;Ui = xi*beta&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Fui = log(ui)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Fui_dev = diag(ui/(1+k*ui))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Vui = diag( 1/sqrt(ui+k*ui##2)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 10pt;"&gt;As I've said, this is a guess. You might get better answers from the SAS Discussion Forum on SAS/STAT and Statistical Procedures.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 10pt;"&gt;For your second question, I'm away from my office, so can't reproduce the error. Perhaps when you correct specify the NB model, this second error will go away. Or someone else might be able to help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2012 20:45:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Negative-binomial-in-IML-and-rounding-error-difficulties-when/m-p/26191#M115</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2012-01-09T20:45:53Z</dc:date>
    </item>
    <item>
      <title>Negative binomial in IML, and rounding error difficulties when computing GINV (and thus SVD)</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Negative-binomial-in-IML-and-rounding-error-difficulties-when/m-p/26192#M116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks very much for your reply.&amp;nbsp; I'm hoping I can feel my way through this...&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 10pt;"&gt;The neqative binomial (NB) model should have a parameter, k, so I don't think your formula is correct.&lt;/SPAN&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 10pt;"&gt; &lt;/SPAN&gt; &lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;Typically, yes, I agree.&amp;nbsp; However, when the REPEATED statement is used in GENMOD (invoking the GEE), ML estimates of the scale (or dispersion for NegBin) disappear, perhaps into the "nuisance" variation associated with the clustering?&amp;nbsp;&amp;nbsp; If k is required, however, I don't have any idea how to get ML estimates of it in IML?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 10pt;"&gt;As best we can tell, &lt;/SPAN&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;the macro writer is using the following definitions for a model with link function g():&lt;/SPAN&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #1f497d; font-size: 10pt;"&gt; &lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #1f497d; font-size: 10pt;"&gt;Ui: mean&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Fui: ginv(mean), i.e. linear predictor&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Fui_dev: diagonal matrix of weights for Fisher scoring = 1/(v(mu)*dg(mu)**2) (not sure about this one: gamma has negative sign?)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Vui: diagonal matrix of inverse of square root of variance.&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;Agree in Ui and Fui.&amp;nbsp; I'll have to defer to you on the others, although the negative sign in the gamma confused me as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #1f497d; font-size: 10pt;"&gt;If these are right, for a log-linked NB with dispersion parameter k, you might try&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #1f497d; font-size: 10pt;"&gt;Ui = xi*beta&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Fui = log(ui)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Fui_dev = diag(ui/(1+k*ui))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;Vui = diag( 1/sqrt(ui+k*ui##2)) &lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;Tried it, and understandably it's looking for a matrix "k".&amp;nbsp; I'll run it by the other forum as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 10pt;"&gt;For your second question, I'm away from my office, so can't reproduce the error. Perhaps when you correct specify the NB model, this second error will go away. Or someone else might be able to help.&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;Alas, no.&amp;nbsp; It's not specific to the NegBin, but occurs with other distributions (e.g., Poisson) as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;BR /&gt;Adam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2012 02:49:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Negative-binomial-in-IML-and-rounding-error-difficulties-when/m-p/26192#M116</guid>
      <dc:creator>AdamSmith</dc:creator>
      <dc:date>2012-01-10T02:49:33Z</dc:date>
    </item>
    <item>
      <title>Negative binomial in IML, and rounding error difficulties when computing GINV (and thus SVD)</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Negative-binomial-in-IML-and-rounding-error-difficulties-when/m-p/26193#M117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; In the example that you provide, the arsumc matrix is a 30x30 matrix with most elements about 1E130.&lt;/P&gt;&lt;P&gt;That's the source of the error reported by GINV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if iteration=1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; _min = min(arsumc);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; _max = max(arsumc);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; _mean = arsumc[:];&lt;/P&gt;&lt;P&gt;&amp;nbsp; print&amp;nbsp; _min&amp;nbsp;&amp;nbsp;&amp;nbsp; _max&amp;nbsp;&amp;nbsp; _mean;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;_min=6113822.2 &lt;/P&gt;&lt;P&gt;_max=1.589E133 &lt;/P&gt;&lt;P&gt;_mean=2.959E131&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2012 20:35:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Negative-binomial-in-IML-and-rounding-error-difficulties-when/m-p/26193#M117</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2012-01-10T20:35:53Z</dc:date>
    </item>
    <item>
      <title>Negative binomial in IML, and rounding error difficulties when computing GINV (and thus SVD)</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Negative-binomial-in-IML-and-rounding-error-difficulties-when/m-p/26194#M118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rick...&amp;nbsp; arsumc gets out of hand quickly...on iteration 1 in fact.&amp;nbsp; I've been running through the meat of the macro variable by variable, and looked into the math behind QIF as best I can (link &lt;A href="http://www.jstor.org/stable/2673612"&gt;here&lt;/A&gt;, if anyone is interested), and I don't think (1) that the macro is up for my specific GEE model (i.e., NegBin with an offset term) and (2) I've got a handle on the linear algebra or IML coding to tackle it.&amp;nbsp; Guess I'll look into alternatives.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for the help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 01:33:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Negative-binomial-in-IML-and-rounding-error-difficulties-when/m-p/26194#M118</guid>
      <dc:creator>AdamSmith</dc:creator>
      <dc:date>2012-01-12T01:33:09Z</dc:date>
    </item>
    <item>
      <title>Negative binomial in IML, and rounding error difficulties when computing GINV (and thus SVD)</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Negative-binomial-in-IML-and-rounding-error-difficulties-when/m-p/26195#M119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One general bit of advice: it is usually a poor idea to interlace macro code and IML. It is almost always unnecessary, and it makes debugging a real pain. By restructuring the logic, you can usually avoid %IF/%THEN and other macro logic and use IML statements instead.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 12:17:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Negative-binomial-in-IML-and-rounding-error-difficulties-when/m-p/26195#M119</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2012-01-12T12:17:04Z</dc:date>
    </item>
  </channel>
</rss>

