The objective function in an optimization must take ONE parameter, although the parameter can be a vector. I see that you defined x0 to be a four-element vector, so I assume you want pass in a four-element vector, like this:
start loglik(parms) global(dp,n);
mp=parms[1]; sp=parms[2]; beta=parms[3]; sq=parms[4];
...
finish;
I have two additional suggestions:
1. If any of these parameters represent variance or standard deviation, be sure to define bounds so that the parameters are positive. For example, if the 2nd and 4th parameters must be positive, you could define
blc = {. 0 . 0, /* lower bounds */
. . . .}; /* upper bounds */
call nlpdd(xr,xc,"loglik",x0) blc=blc;
2. Before you try to optimize, you should look at the "Ten tips before you run an optimization."
... View more