Skip to content
Prev 275826 / 398506 Next

Error in optim

The likelihood function is a product. Thus, the log likelihood function is a
sum. Your log.lik statement, however, fails to compute the sum, which it
should minimize. Hence your optim statement does not know what to optimize
because log.lik is a vector of the length of the number of observations in
your data (100) when it should be of length (1), i.e., the sum of the
former. If you define log.lik as the appropriate sum, you should be
successful.

HTH.
Daniel
djbanana wrote:
--
View this message in context: http://r.789695.n4.nabble.com/Error-in-optim-tp3948980p3949006.html
Sent from the R help mailing list archive at Nabble.com.