(a) This is pretty obviously homework; the r-help list is *not* for
giving help with homework.
(b) *Read* the error message!
(c) Your expression for the log likelihood is wrong in more than
one way. (The number of observations is *not* the same thing
as the number of trials for a given observa
jango wrote:
>
> I'm trying to calculate the maximum likelihood estimate for a binomial
> distribution. Here is my code:
>
> y <- c(2, 4, 2, 4, 5, 3)
> n <- length(y)
> binomial.ll <- function (pi, y, n) {## define log-likelihood
> output <- y*log(pi)+(n-y)*(log(1-pi))
> return(outp
I'm trying to calculate the maximum likelihood estimate for a binomial
distribution. Here is my code:
y <- c(2, 4, 2, 4, 5, 3)
n <- length(y)
binomial.ll <- function (pi, y, n) {## define log-likelihood
output <- y*log(pi)+(n-y)*(log(1-pi))
return(output)
}
binomial.mle <- optim(0.01,
3 matches
Mail list logo