T-ACD Syntax error

I only need the parameter and MLE value, the changed code is in the following . yet it  appears the Syntax error, how to modify?

(0) : error G0008 : '(B,p[vfor($1)],xi),par)' : Syntax error
(0) : error G0155 : Nested procedure definition

proc(2)=directsearch(xi);
local n,n1,n2,p_s,p,c_n;
local pp,pp1,f,f1,g,g1,cov,cov1,retcode,retcode1,MLE,MLE1;
n=rows(xi);
n1=round(0.2*n);
n2=round(0.8*n);
p_s=unique(xi,1);
p=p_s[n1:n2];
c_n=rows(p);
pp=zeros(7,c_n);
MLE=zeros(n-1,c_n); // how to set the initial value??
//////////////////////////////////////////////////////////////////////////
for i(1,c_n,1);

{pp1,f1,g1,cov1,retcode1}=cml(xi,0,&T_li_ACD(B,p[i],xi),par);
pp[.,i] = pp1;
MLE1=T_li_ACD(pp[.,],P[i],xi);
MLE[.,i] = MLE1;

endfor;
retp(pp,MLE);
endp;

/*------------------------------------------------------------------------------------*/
proc T_li_ACD (B,p,Xi);
/********************************************************************************************
Likelihood Procedure for threshold ACD Models:
********************************************************************************************/

local omega1,alpha1, beta1,omega2,alpha2, beta2,n;
local XI1,XI2,MXI, psi1,psi2,regime1,regime2,likeli1,likeli2,likeli;

omega1 = B[1];
alpha1 = B[2];
beta1 = B[3];
omega2 = B[4];
alpha2 = B[5];
beta2 = B[6];
n=rows(xi);
XI1=selif(XI[2:n],XI[1:n-1].<=P);
XI2=selif(XI[2:n],XI[1:n-1].>P);

MXI =xi[1:(n-1)];

psi1 = recserar(omega1 + MXI*alpha1,
meanc(XI1)*ones(1,1),
beta1);
psi2 = recserar(omega2 + MXI*alpha2 ,
meanc(XI2)*ones(1,1),
beta2);
regime1=(XI[1:n-1].<=p);
regime2=(XI[1:n-1].>p);
likeli1 = -(ln(psi1)+(XI[2:n]./psi1));
likeli2 = -(ln(psi2)+(XI[2:n]./psi2));
likeli=likeli1.*regime1+likeli2.*regime2;

retp(likeli);
endp;

Your Answer


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.