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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With