title: how to graph the log likelihood function
body: <p>I want to graph the log likelihood function between -pi and pi.</p>
  
  <p><strong>the log likelihood function</strong></p>
  
  <pre><code>llh &lt;- function (teta,x) {
  
    sum(log((1-cos(x-teta))/(2*pi)))
  }
  
  x=c(3.91,4.85,2.28,4.06,3.70,4.04,5.46,3.53,2.28,1.96,2.53,3.88,2.22,3.47,4.82,2.46,2.99,2.54,0.52,2.50)
  
  teta=seq(-4,4, by=0.01)
  
  y = llh(teta,x)
  
  plot(teta, llh(teta,x), pch=16)
  </code></pre>
  
  <p><strong>It failed to plot the function. Here's the error message:</strong></p>
  
  <pre><code>Warning message:
  In x - teta :
    longer object length is not a multiple of shorter object length
  &gt;   
  &gt; plot(teta, llh(teta,x), pch=16)
  Error in xy.coords(x, y, xlabel, ylabel, log) : 
    'x' and 'y' lengths differ
  In addition: Warning message:
  In x - teta :
    longer object length is not a multiple of shorter object length
  </code></pre>