Skip to content
Snippets Groups Projects
Commit cc0e0468 authored by Eduardo E. R. Junior's avatar Eduardo E. R. Junior
Browse files

Adiciona função para cálculo da constante Z

parent 75fd60de
No related branches found
No related tags found
No related merge requests found
...@@ -45,7 +45,7 @@ opts_chunk$set( ...@@ -45,7 +45,7 @@ opts_chunk$set(
##====================================================================== ##======================================================================
## Configura opções de output no documento ## Configura opções de output no documento
options(digits = 3, OutDec = ",", options(digits = 3, OutDec = ",", scipen=-1,
xtable.caption.placement = "top", xtable.caption.placement = "top",
xtable.include.rownames = FALSE, xtable.include.rownames = FALSE,
xtable.booktabs = TRUE) xtable.booktabs = TRUE)
...@@ -101,6 +101,21 @@ fonte <- function(texto, side = 1, line = -1, adj = 0, ...@@ -101,6 +101,21 @@ fonte <- function(texto, side = 1, line = -1, adj = 0,
invisible() 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 ## Para padronizar as analises de deviance de todos os modelos
## - ## -
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment