Skip to content

Commit

Permalink
Update in the example of aodml
Browse files Browse the repository at this point in the history
  • Loading branch information
aursiber committed Nov 4, 2024
1 parent aef1191 commit ad9d56e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions R/aodml.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ aodml <- function(formula, data, family = c("bb", "nb"),
a <- (k - 1) * mu
b <- (k - 1) * (1 - mu)
if (log)
lbeta(a + m, b + n - m) - lbeta(a, b) + lchoose(n, m)
suppressWarnings(lbeta(a + m, b + n - m) - lbeta(a, b) + lchoose(n, m))
}

m.logL <- function(theta) {
Expand All @@ -98,7 +98,7 @@ aodml <- function(formula, data, family = c("bb", "nb"),
l <- dbetabin(m = m, n = n, mu = mu, k = k, log = TRUE)

if (fam == "nb")
l <- dnbinom(x = y, mu = mu, size = k, log = TRUE)
suppressWarnings(l <- dnbinom(x = y, mu = mu, size = k, log = TRUE))

-sum(l)

Expand Down
6 changes: 4 additions & 2 deletions man/aodml.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ The full parameter vector returned by \code{aodml}, say \code{param}, is equal t
#------ Beta-binomial model

data(orob2)

fm1 <- aodml(cbind(m, n - m) ~ seed, data = orob2, family = "bb")
names(fm1)

# summaries
fm1
Expand Down Expand Up @@ -255,15 +257,15 @@ fm$varparam

# model with 2 phi coefficients, with the first set as constant ~ "0"
fm <- aodml(formula = cbind(m, n - m) ~ seed * root, data = orob2,
family = "bb", phi.formula = ~ seed, fixpar = list(5, 1e-15))
family = "bb", phi.formula = ~ seed, fixpar = list(5, 1e-8))
fm$param
fm$varparam

# model with 2 phi coefficients, with the first set as constant ~ "0",
# and the mu intercept (1rst coef of vector b) set as as constant "-0.5"
fm <- aodml(formula = cbind(m, n - m) ~ seed * root, data = orob2,
family = "bb", phi.formula = ~ seed,
fixpar = list(c(1, 5), c(-0.5, 1e-15)))
fixpar = list(c(1, 5), c(-0.5, 1e-8)))
fm$param
fm$varparam

Expand Down

0 comments on commit ad9d56e

Please sign in to comment.