title: finding MLE for Epsilon skew exponential distrbiution
body: <p>I am running the following R code to find the MLE of the Epsilon Skew exponential distribution:</p>
  
  <p><a href="https://i.stack.imgur.com/ikNSp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ikNSp.png" alt="enter image description here"></a> </p>
  
  <p>but I have the following errors along with many warnings. I have searched thoroughly but have found no helpful answers.</p>
  
  <blockquote>
    <p>Error in fn(par, ...) : argument "sig" is missing, with no default</p>
    
    <p>Warning messages:</p>
    
    <p>1: In nlminb(start = c(1, 2, 0.5, 2), objective = fESEP1,  ... :
      NA/NaN function evaluation</p>
    
    <p>2: In nlminb(start = c(1, 2, 0.5, 2), objective = fESEP1,  ... :</p>
  </blockquote>
  
  <p>Here is my program </p>
  
  <pre><code>x &lt;- c(2,5,3,7,3,2,0,2)
  fESEP&lt;- function(theta){
     th&lt;-theta[1]
     sig&lt;-theta[2]
     eps&lt;-theta[3]
     alp&lt;-theta[4]
  
     a = log(gamma(1+1/alp))
     b = ((1+eps)*sig*sqrt(2))^alp
     c = ((1-eps)*sig*sqrt(2))^alp
     d = log (sig)
     y1= (x-th)^alp
     y2= (th-x)^alp
     ans &lt;- a + d + sum(y1/b)*ifelse(y2 &lt; 0 ,1,0) +
            a + d + sum(y2/c)*ifelse( y1&gt;= 0 ,1,0)
  return(ans)
  } 
  
  optim(c(3,2,0.5, 1), fESEP, hessian=TRUE)
  nlminb(start=c(1,2,0.5, 2), objective = fESEP,
         control=list(abs.tol = 0.00001,iter.max=100,trace=TRUE))
  </code></pre>