Hello, I'm a student and for a school project, i need to compute many loglikelihood of a logit model based on Spector and Mazzeo's article, and this in order to produce a 3D plot. So for this i created a sequence of parameters and i try to compute log likelihood for each couple of parameters and used a loop for this. But programe refuses to execute at 28th iteration and i don't understand why. Here is my code : data spector;
input grade const tuce gpa ;
cards;
0 1 20 2.66
0 1 22 2.89
0 1 24 3.28
0 1 12 2.92
0 1 17 2.86
0 1 17 2.76
0 1 21 2.87
0 1 25 3.03
0 1 20 2.63
0 1 23 3.32
0 1 23 3.57
0 1 26 3.53
0 1 19 2.74
0 1 25 2.75
0 1 19 2.83
0 1 23 3.12
0 1 22 2.06
0 1 14 2.89
0 1 26 3.51
0 1 24 2.67
0 1 21 3.10
1 1 21 4.00
1 1 29 3.92
1 1 25 3.26
1 1 25 3.16
1 1 28 3.62
1 1 24 3.54
1 1 27 2.83
1 1 17 3.39
1 1 21 3.65
1 1 23 4.00
1 1 19 2.39
;
run;
PROC IML ;
use spector;
read all var{const tuce gpa} into X;
read all var{grade} into Y ;
close spector;
print X Y ;
N = nrow(X);
*step 1 : beta sequence ;
X2=do(-1.5,1.5,0.5)`;
X3=do(1,4,0.5)`;
nX2=nrow(X2);
nX3=nrow(X3);
print nX2, nX3;
*step 2 : beta occurence;
rX2=repeat(X2,nX3,1);
rX3=repeat(X3,nX2,1);
rcst=repeat(-10.656002,nrow(rX2),1);
print rX2, rX3;
*step 3 sort;
call sort(rX3);
print rX3;
*step 4 concat;
theta=rcst||rX2||rX3;
ntheta = nrow(theta);
print theta ntheta;
*step 5 compute loglikelihood for each sequence of beta;
*Compute log likelihood of the sample;
do j=1 to 49;
XB = X*(theta`)[,j];
expXB = exp(XB);
P = expXB/(1+expXB);
logli1 = (Y#log(P))[+] ;
b=1-P;
a = 1-Y;
logli2 = (log(b##a))[+];
logli = logli1 + logli2 ;
logln = logln//logli ;
end;
print logln; I know that " b##a " is not a good way but it's the only one i've found. Someone can help me please ? Thank you in advance for helping.
... View more