Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hessian in SAS?

Is there any way to get the Hessian matrix in the proc logistic in SAS? Or which will be an option to calculated it taking from departure the proc logsitic?

I have been reading the function documentation but cannot see that there is a way to include it in the output tables.

like image 948
user1571823 Avatar asked Nov 10 '22 19:11

user1571823


1 Answers

I scoured the SAS blogs and may have found a way you can estimate it using proc nlp.

data t1;
do i = 1 to 500;
x=rannor(3478);
y=1+2*x>rannor(3478);
output;
end;
run;

proc logistic data=t1 outest=parm covout desc;
model y=x/link=probit;
score data=t1 out=t2;
run;

proc nlp data=t1 outest=t2 PHESSIAN;
parms a=0, b=0 ;
max ll;
xbeta = a + b * x;
if y=1 then p=probnorm(xbeta);
else if y=0 then p=1-probnorm(xbeta);
ll=LOG(p);
run;

proc print data=parm(where=(_TYPE_='COV')); run;

*calculation covariance from hessian in above;
proc iml;

HESSIAN={ -143.2141617 64.771275623,
64.771275623 -64.13869603
};
HESSIAN_inv_neg=-inv(HESSIAN);
print HESSIAN ;
print HESSIAN_inv_neg;
quit;

Hope this helps.

Original answer posted here: http://comp.soft-sys.sas.narkive.com/nXdobtA5/hessian-and-scores-in-the-logistic-proc

like image 85
JJFord3 Avatar answered Dec 22 '22 21:12

JJFord3