Displaying 3 results from an estimated 3 matches for "dmnom2".
2012 Oct 05
2
problem with convergence in mle2/optim function
...dary? If
so, any suggestions on how to estimate parameter values that are near zero?
Here is reproducible and relevant code from my stochastic simulation:
########################################################################
library(bbmle)
library(combinat)
# define multinomial distribution
dmnom2 <- function(x,prob,log=FALSE) {
r <- lgamma(sum(x) + 1) + sum(x * log(prob) - lgamma(x + 1))
if (log) r else exp(r)
}
# vector of time points
tv <- 1:20
# Negative log likelihood function
NLL.func <- function(p1, p2, mu1, mu2, y){
t <- y$tv
n1 <- y$n1
n2 <- y$n...
2012 Oct 11
2
model selection with spg and AIC (or, convert list to fitted model object)
...functions? Alternatively, how can I convert the list returned
by spg into a fitted model object that can be run in AIC, ICtab, or anova?
Here is an example:
##########################################################################
library(BB)
library(bbmle)
# define multinomial distribution
dmnom2 <- function(x,prob,log=FALSE) {
r <- lgamma(sum(x) + 1) + sum(x * log(prob) - lgamma(x + 1))
if (log) r else exp(r)
}
# data frame y
y <- structure(list(tv = 1:20, n1 = c(17L, 18L, 16L, 18L, 16L, 16L,
18L, 18L, 20L, 16L, 20L, 16L, 17L, 17L, 18L, 19L, 18L,
16L, 17L,...
2012 Sep 27
0
problems with mle2 convergence and with writing gradient function
...e time.
First question: Does anyone have suggestions on how to improve the rate
of convergence and avoid the "finite values of 'fn'" error?
Here is reproducible and relevant code from my stochastic simulation:
library(bbmle)
library(combinat)
# define multinomial distribution
dmnom2 <- function(x,prob,log=FALSE) {
r <- lgamma(sum(x) + 1) + sum(x * log(prob) - lgamma(x + 1))
if (log) r else exp(r)
}
# vector of time points
tv <- 1:20
# Negative log likelihood function
NLL.func <- function(p1, p2, mu1, mu2, y){
t <- y$tv
n1 <- y$n1
n2 <- y$n...