From a6911f8f7bff7169a19331b74459f01d2b2c8f52 Mon Sep 17 00:00:00 2001 From: Eduardo Junior <edujrrib@gmail.com> Date: Sat, 21 May 2016 22:47:50 -0300 Subject: [PATCH] =?UTF-8?q?Adiciona=20m=C3=A9todo=20de=20predi=C3=A7=C3=A3?= =?UTF-8?q?o=20para=20modelos=20COM-Poisson?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/methods.R | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/R/methods.R b/R/methods.R index 11e2c42..05c388e 100644 --- a/R/methods.R +++ b/R/methods.R @@ -191,6 +191,22 @@ predict.mle2 <- function(object, newdata, MARGIN = 2, FUN = calc_mean_gcnt, alpha = exp(coef(object)[1]))}) + }, + "llcmp" = { + V <- vcov(object) + Vc <- V[-1, -1] - V[-1, 1] %*% + solve(V[1, 1]) %*% V[1, -1] + eta <- cholV_eta(Vc, X, + b = coef(object)[-1], + qn = qn) + switch(type, + "link" = eta, + "response" = { + apply(exp(as.matrix(eta)), + MARGIN = 2, + FUN = calc_mean_cmp, + nu = exp(coef(object)[1]), + sumto = object@data$sumto)}) }) pred <- cbind(pred) colnames(pred) <- names(qn) -- GitLab