I should start by saying what I\'m trying to do: I want to use the mle function without having to re-write my log likelihood function each time I want to try a different model s
It might not be what you're looking for, but I would do this as follows:
mle2(y ~ dnorm(mu, sigma),parameters=list(mu~x1 + x2), data = df,
start = list(mu = 1,sigma = 1))
mle2(y ~ dnorm(mu,sigma), parameters = list(mu ~ x1), data = df,
start = list(mu=1,sigma=1))
You might be able to adapt this formulation for a multinomial, although dmultinom
might not work -- you might need to write a Dmultinom()
that took a matrix of multinomial samples and returned a (log)probability.