Displaying 1 result from an estimated 1 matches for "sdy0".
Did you mean:
sd0
2008 Dec 31
2
function of mixture normal with covariates
...eany0,meany1,stdy0,stdy1,dx,V,d),logl)
Error in optim(c(meany0, meany1, stdy0, stdy1, dx, V, d), logl) :
function cannot be evaluated at initial parameters
>
This is what I wrote
# maximizing the log likelihood function
logl<-function(param,y,x)
{
mu0=param[1]
mu1=param[2]
sdy0=param[3]
sdy1=param[4]
pix_pred=param[5]
v_pred=param[6]
dxynew=param[7]
f3=-(sum(dxynew*(log(pix_pred)-log(sdy1)-0.5*((y-mu1-(rho*sdy1*x)/sdy1)^2))+
sum((1-dxynew)*(log(1-pix_pred)-log(sdy0)
-0.5*((y-mu0-(rho*sdy0*x)/sdy0)^2))
+log(v_pred))
return (-f3)
}
Need help please....