<?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 How do I solve WARNING:The final Hessian matrix is full rank but has at least one negative eigenvalu in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-solve-WARNING-The-final-Hessian-matrix-is-full-rank-but/m-p/766387#M37465</link>
    <description>&lt;P&gt;Hi!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to run a marginalised two part model with generalised gamma distribution for semicontinuous data to get the mean costs of all in my study population, rather than a mean conditioned on having expenditure. However after running the syntax below, I get the following warning in the log:&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Convergence criterion (GCONV=1E-8) satisfied.&lt;BR /&gt;NOTE: At least one element of the gradient is greater than 1e-3.&lt;BR /&gt;NOTE: Moore-Penrose inverse is used in covariance matrix.&lt;BR /&gt;WARNING: The final Hessian matrix is full rank but has at least one negative eigenvalue.&lt;BR /&gt;Second-order optimality condition violated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have rescaled the cost outcomes from swedish krona to euros and this helped with some cost outcomes but not all. Any other suggestions/ solutions?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%macro mtpmacroms (a0 ,a1, b0, b1, kappa, x1, y);&lt;BR /&gt;proc nlmixed data=studypop1 MAXIT=1000 ;&lt;BR /&gt;/* provide starting values for parameters */&lt;BR /&gt;parms a0=&amp;amp;a0. a1=&amp;amp;a1.&lt;BR /&gt;b0=&amp;amp;b0. b1=&amp;amp;b1. kappa=&amp;amp;kappa.&lt;BR /&gt;s0=0 s1=0;&lt;BR /&gt;/* Specify mean model for binary part */&lt;BR /&gt;linbin=a0+(&amp;amp;x1.*a1);&lt;BR /&gt;binprob=exp(linbin)/(1+exp(linbin));/* prob y&amp;gt;0 */&lt;BR /&gt;eta=abs(kappa)**(-2);&lt;BR /&gt;/* Define heterogeneous variance as a function of MOVE status */&lt;BR /&gt;logsigma = S0+S1*&amp;amp;x1.;&lt;BR /&gt;sigma=exp(logsigma);&lt;BR /&gt;/* Add covariates to mean model, changing only first line */&lt;BR /&gt;mu=b0+(b1*&amp;amp;x1.)&lt;BR /&gt;- log(binprob) - (sigma*log((kappa)**2))/kappa&lt;BR /&gt;-log(GAMMA(1/((kappa)**2)+sigma/kappa))+log(GAMMA(1/((kappa)**2)));&lt;BR /&gt;/* set up likelihood */&lt;BR /&gt;if &amp;amp;y. =0 then loglik=log(1-binprob);&lt;BR /&gt;else if &amp;amp;y.&amp;gt;0 then do;&lt;BR /&gt;u=SIGN(kappa)*(log(&amp;amp;y.)-mu)/sigma;&lt;BR /&gt;loglik=log(binprob)+eta*log(eta)-log(sigma)-log(&amp;amp;y.)&lt;BR /&gt;-log(GAMMA(eta))-.5*log(eta)+u*sqrt(eta)-eta*exp(abs(kappa)*u);&lt;BR /&gt;end;&lt;BR /&gt;model &amp;amp;y.~general(loglik);&lt;BR /&gt;/* Function to predict mean total cost for everyone in dataset */&lt;BR /&gt;pred_&amp;amp;y.=exp(b0+b1*&amp;amp;x1.);&lt;BR /&gt;predict pred_&amp;amp;y. out=mtpgg_&amp;amp;y.;&lt;BR /&gt;/* Estimate functions of parameters */&lt;BR /&gt;estimate "multiplicative effect of &amp;amp;x1. on &amp;amp;y." exp(b1);&lt;BR /&gt;estimate "total &amp;amp;y. for PwMS" exp(b0+b1);&lt;BR /&gt;estimate "total &amp;amp;y. for references" exp(b0);&lt;BR /&gt;run;&lt;BR /&gt;/* get predicted mean estimates*/&lt;BR /&gt;proc sort data=mtpgg_&amp;amp;y.;&lt;BR /&gt;by MS; run;&lt;BR /&gt;proc means data=mtpgg_&amp;amp;y.;&lt;BR /&gt;var Pred;&lt;BR /&gt;by MS;&lt;BR /&gt;run;&lt;BR /&gt;%mend mtpmacroms;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%mtpmacroms (a0=-2.6864 ,a1=1.1718 , b0=9.1899, b1=-1.2885, kappa= 0.6116, x1=MS, y=hc_costs_eur);&lt;/P&gt;&lt;P&gt;starting values from a logistic model for a and glm (gamma log link) for b&lt;/P&gt;</description>
    <pubDate>Tue, 07 Sep 2021 14:05:02 GMT</pubDate>
    <dc:creator>ChantelleM</dc:creator>
    <dc:date>2021-09-07T14:05:02Z</dc:date>
    <item>
      <title>How do I solve WARNING:The final Hessian matrix is full rank but has at least one negative eigenvalu</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-solve-WARNING-The-final-Hessian-matrix-is-full-rank-but/m-p/766387#M37465</link>
      <description>&lt;P&gt;Hi!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to run a marginalised two part model with generalised gamma distribution for semicontinuous data to get the mean costs of all in my study population, rather than a mean conditioned on having expenditure. However after running the syntax below, I get the following warning in the log:&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Convergence criterion (GCONV=1E-8) satisfied.&lt;BR /&gt;NOTE: At least one element of the gradient is greater than 1e-3.&lt;BR /&gt;NOTE: Moore-Penrose inverse is used in covariance matrix.&lt;BR /&gt;WARNING: The final Hessian matrix is full rank but has at least one negative eigenvalue.&lt;BR /&gt;Second-order optimality condition violated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have rescaled the cost outcomes from swedish krona to euros and this helped with some cost outcomes but not all. Any other suggestions/ solutions?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%macro mtpmacroms (a0 ,a1, b0, b1, kappa, x1, y);&lt;BR /&gt;proc nlmixed data=studypop1 MAXIT=1000 ;&lt;BR /&gt;/* provide starting values for parameters */&lt;BR /&gt;parms a0=&amp;amp;a0. a1=&amp;amp;a1.&lt;BR /&gt;b0=&amp;amp;b0. b1=&amp;amp;b1. kappa=&amp;amp;kappa.&lt;BR /&gt;s0=0 s1=0;&lt;BR /&gt;/* Specify mean model for binary part */&lt;BR /&gt;linbin=a0+(&amp;amp;x1.*a1);&lt;BR /&gt;binprob=exp(linbin)/(1+exp(linbin));/* prob y&amp;gt;0 */&lt;BR /&gt;eta=abs(kappa)**(-2);&lt;BR /&gt;/* Define heterogeneous variance as a function of MOVE status */&lt;BR /&gt;logsigma = S0+S1*&amp;amp;x1.;&lt;BR /&gt;sigma=exp(logsigma);&lt;BR /&gt;/* Add covariates to mean model, changing only first line */&lt;BR /&gt;mu=b0+(b1*&amp;amp;x1.)&lt;BR /&gt;- log(binprob) - (sigma*log((kappa)**2))/kappa&lt;BR /&gt;-log(GAMMA(1/((kappa)**2)+sigma/kappa))+log(GAMMA(1/((kappa)**2)));&lt;BR /&gt;/* set up likelihood */&lt;BR /&gt;if &amp;amp;y. =0 then loglik=log(1-binprob);&lt;BR /&gt;else if &amp;amp;y.&amp;gt;0 then do;&lt;BR /&gt;u=SIGN(kappa)*(log(&amp;amp;y.)-mu)/sigma;&lt;BR /&gt;loglik=log(binprob)+eta*log(eta)-log(sigma)-log(&amp;amp;y.)&lt;BR /&gt;-log(GAMMA(eta))-.5*log(eta)+u*sqrt(eta)-eta*exp(abs(kappa)*u);&lt;BR /&gt;end;&lt;BR /&gt;model &amp;amp;y.~general(loglik);&lt;BR /&gt;/* Function to predict mean total cost for everyone in dataset */&lt;BR /&gt;pred_&amp;amp;y.=exp(b0+b1*&amp;amp;x1.);&lt;BR /&gt;predict pred_&amp;amp;y. out=mtpgg_&amp;amp;y.;&lt;BR /&gt;/* Estimate functions of parameters */&lt;BR /&gt;estimate "multiplicative effect of &amp;amp;x1. on &amp;amp;y." exp(b1);&lt;BR /&gt;estimate "total &amp;amp;y. for PwMS" exp(b0+b1);&lt;BR /&gt;estimate "total &amp;amp;y. for references" exp(b0);&lt;BR /&gt;run;&lt;BR /&gt;/* get predicted mean estimates*/&lt;BR /&gt;proc sort data=mtpgg_&amp;amp;y.;&lt;BR /&gt;by MS; run;&lt;BR /&gt;proc means data=mtpgg_&amp;amp;y.;&lt;BR /&gt;var Pred;&lt;BR /&gt;by MS;&lt;BR /&gt;run;&lt;BR /&gt;%mend mtpmacroms;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%mtpmacroms (a0=-2.6864 ,a1=1.1718 , b0=9.1899, b1=-1.2885, kappa= 0.6116, x1=MS, y=hc_costs_eur);&lt;/P&gt;&lt;P&gt;starting values from a logistic model for a and glm (gamma log link) for b&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 14:05:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-solve-WARNING-The-final-Hessian-matrix-is-full-rank-but/m-p/766387#M37465</guid>
      <dc:creator>ChantelleM</dc:creator>
      <dc:date>2021-09-07T14:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I solve WARNING:The final Hessian matrix is full rank but has at least one negative eigen</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-solve-WARNING-The-final-Hessian-matrix-is-full-rank-but/m-p/766388#M37466</link>
      <description>&lt;P&gt;This has been discussed many times in this forum; please do a search for similar problems and answers.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 14:07:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-solve-WARNING-The-final-Hessian-matrix-is-full-rank-but/m-p/766388#M37466</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-09-07T14:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I solve WARNING:The final Hessian matrix is full rank but has at least one negative eigen</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-solve-WARNING-The-final-Hessian-matrix-is-full-rank-but/m-p/766396#M37469</link>
      <description>&lt;P&gt;From your description of your data, it sounds like your response is continuous and positive but also contains a mass of values (possibly many) that are zero. If that is the case, you might consider alternative methods that are described and illustrated in &lt;A href="https://support.sas.com/kb/68/202.html" target="_self"&gt;this note&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 14:31:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-solve-WARNING-The-final-Hessian-matrix-is-full-rank-but/m-p/766396#M37469</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2021-09-07T14:31:27Z</dc:date>
    </item>
  </channel>
</rss>

