Dear R-users,

Suppose I have defined a likelihood function as ll(tau), how can I plot this
likelihood function by calling it by plot?

I want to do it like this:

ll <- function(tau)
  {
    w <- 1 / (s^2 + tau^2)
    mu <- sum(theta * w) / sum(w)
    -1/2*sum((theta-mu)^2*w -log(w))
  }
plot(ll, 0, 2)



But have the following error:
Error in xy.coords(x, y, xlabel, ylabel, log) :
  'x' and 'y' lengths differ
In addition: Warning messages:
1: In s^2 + tau^2 :
  longer object length is not a multiple of shorter object length
2: In theta * w :
  longer object length is not a multiple of shorter object length
3: In (theta - mu)^2 * w :
  longer object length is not a multiple of shorter object length


Thanks

	[[alternative HTML version deleted]]

