BookmarkSubscribeRSS Feed
ChantelleM
Calcite | Level 5

Hi! 

 

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: 

NOTE: Convergence criterion (GCONV=1E-8) satisfied.
NOTE: At least one element of the gradient is greater than 1e-3.
NOTE: Moore-Penrose inverse is used in covariance matrix.
WARNING: The final Hessian matrix is full rank but has at least one negative eigenvalue.
Second-order optimality condition violated

 

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? 

 


%macro mtpmacroms (a0 ,a1, b0, b1, kappa, x1, y);
proc nlmixed data=studypop1 MAXIT=1000 ;
/* provide starting values for parameters */
parms a0=&a0. a1=&a1.
b0=&b0. b1=&b1. kappa=&kappa.
s0=0 s1=0;
/* Specify mean model for binary part */
linbin=a0+(&x1.*a1);
binprob=exp(linbin)/(1+exp(linbin));/* prob y>0 */
eta=abs(kappa)**(-2);
/* Define heterogeneous variance as a function of MOVE status */
logsigma = S0+S1*&x1.;
sigma=exp(logsigma);
/* Add covariates to mean model, changing only first line */
mu=b0+(b1*&x1.)
- log(binprob) - (sigma*log((kappa)**2))/kappa
-log(GAMMA(1/((kappa)**2)+sigma/kappa))+log(GAMMA(1/((kappa)**2)));
/* set up likelihood */
if &y. =0 then loglik=log(1-binprob);
else if &y.>0 then do;
u=SIGN(kappa)*(log(&y.)-mu)/sigma;
loglik=log(binprob)+eta*log(eta)-log(sigma)-log(&y.)
-log(GAMMA(eta))-.5*log(eta)+u*sqrt(eta)-eta*exp(abs(kappa)*u);
end;
model &y.~general(loglik);
/* Function to predict mean total cost for everyone in dataset */
pred_&y.=exp(b0+b1*&x1.);
predict pred_&y. out=mtpgg_&y.;
/* Estimate functions of parameters */
estimate "multiplicative effect of &x1. on &y." exp(b1);
estimate "total &y. for PwMS" exp(b0+b1);
estimate "total &y. for references" exp(b0);
run;
/* get predicted mean estimates*/
proc sort data=mtpgg_&y.;
by MS; run;
proc means data=mtpgg_&y.;
var Pred;
by MS;
run;
%mend mtpmacroms;

 

%mtpmacroms (a0=-2.6864 ,a1=1.1718 , b0=9.1899, b1=-1.2885, kappa= 0.6116, x1=MS, y=hc_costs_eur);

starting values from a logistic model for a and glm (gamma log link) for b

2 REPLIES 2
PaigeMiller
Diamond | Level 26

This has been discussed many times in this forum; please do a search for similar problems and answers.

--
Paige Miller
StatDave
SAS Super FREQ

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 this note

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 759 views
  • 1 like
  • 3 in conversation