Displaying 1 result from an estimated 1 matches for "lik2b".
Did you mean:
lik1b
2007 Oct 24
1
vectorized mle / optim
..., param["m"], sqrt(param["v"]/N), log = T) :
argument "param" is missing, with no default"
One could trust the error message and provide default values, but
unfortunately,
-------------------------------- example 2b ------------ 8<
----------------------
lik2b <- function(param=c(m=1, v=1), data) {
N <- length(data)
lik.mean <- dnorm(mean(data), param["m"], sqrt(param["v"]/N), log=T)
lik.var <- dchisq(N*var(data)/param["v"], N-1, log=T)
return(-lik.mean - lik.var)
}
ml.result <- mle(lik2b, start=list(p...