diff --git a/docs/_setup.R b/docs/_setup.R index 0f04474eea6952f23e1301322e942d5ee5b28426..4575413bab244265a1efe3029e23a76f207531ec 100644 --- a/docs/_setup.R +++ b/docs/_setup.R @@ -45,7 +45,7 @@ opts_chunk$set( ##====================================================================== ## Configura opções de output no documento -options(digits = 3, OutDec = ",", +options(digits = 3, OutDec = ",", scipen=-1, xtable.caption.placement = "top", xtable.include.rownames = FALSE, xtable.booktabs = TRUE) @@ -101,6 +101,21 @@ fonte <- function(texto, side = 1, line = -1, adj = 0, invisible() } +##====================================================================== +## Calcula Z para um c(lambda, phi) +funZ <- function(lambda, nu, maxit = 500, tol = 1e-5) { + z <- rep(NA, maxit) + j = 1 + ## + z[j] <- exp(j * log(lambda) - nu * lfactorial(j)) + ## + while (abs(z[j] - 0) > tol && j <= maxit) { + j = j + 1 + z[j] <- exp(j * log(lambda) - nu * lfactorial(j)) + } + return(cbind("j" = 0:j, "z" = c(1, z[!is.na(z)]))) +} + ##====================================================================== ## Para padronizar as analises de deviance de todos os modelos ## -