Log likelihood function I am attempting to plot a log likelihood function in R for a Cauchy distribution for a sample size of three. I tried using the rcauchy command and I'm not getting very far. Would really appreciate some guidance in how to go about this.
 A: Because the log likelihood function doesn't seem to make much sense unless there is at least one parameter, and because it is unclear to me how you'd want to plot if there are two parameters, I have chosen to look at Cauchys with location parameter $\eta$ (eta) and unit scale parameter. The location parameter is the median and
mode, but of course not the mean (which doesn't exist).
I begin by generating three observations from a Cauchy with $\eta=5$.
Then I find the log likelihood function in two ways: (a) using Wikipedia's
formula, and (b) letting R multiply the three PDFs and then taking the log.
Happily, it turns out that the two methods produce indistinguishable results.
I treat the observations as fixed, and vary $\eta$ through m = 1000 values
even spaced in a relatively long interval (-50, 50).
I plot both versions of the likelihood curve (side by side), details of which (of course) depend
on the three observations generated at the start. For the seed shown,
two distinct relative maxima are visible. Other seeds make graphs that
show one, two, or three relative maxima. Of course, the highest one gives the MLE.
You can omit the seed statement and run the code repeatedly to get a variety of observation triads and hence a
variety of different likelihood curves. 
Finally, I print the data, show its median, and show the MLEs from both curves.
I do not show any plots because you say you are running R and you should have
no difficulty making multiple plots on your own. Not sure exactly what you're
asking, and I don't claim the code is elegant, but I hope it's of some help.
set.seed(1235);  x = rcauchy(3, 5, 1)
m = 1000;  eta = seq(-50,50, leng=m);  llik.a = llik.b = numeric(m)
for(i in 1:m) { 
llik.a[i] = -sum(log(1+(x-eta[i])^2)) - 3*log(pi)
like = prod(dcauchy(x, eta[i], 1)); llik.b[i] = log(like) }
par(mfrow=c(1,2))
plot(eta,llik.a, type="l")
eta.mle.a = eta[llik.a==max(llik.a)];  abline(v = eta.mle.a, col="green")
plot(eta,llik.b, type="l")
eta.mle.b = eta[llik.b==max(llik.b)];  abline(v = eta.mle.b, col="green")
par(mfrow=c(1,1))
x;  median(x);  eta.mle.a;  eta.mle.b
