[ADMB Users] Fwd: glmmADMB predict with negative binomial

jnancheta jnancheta at gmail.com
Wed Dec 10 16:35:36 PST 2014


---------- Forwarded message ----------
From: <sheryn.olson at maine.edu>
Date: Fri, Nov 28, 2014 at 8:26 AM
Subject: glmmADMB predict with negative binomial
To: admb-users+owners at googlegroups.com


Hello, May I post a question?

I would like to plot a predictive graph of hare pellet count response vs.
conifer saplings.

It is unclear to me what predict.glmmADMB extracts when the family is
nbinom, with log-link.

The documentation says
[type   Whether to return predictions on the scale of the linear predictor
("link") or the scale of the data ("response")]

Does that mean specifying      type = "link"    will extract exponentiated
fits?
Or do I exponentiate the fit AFTER it is extracted by predict?

R-code follows
    Call:
    glmmadmb(formula = pellets ~ season * t.con.splgs + offset(ln.days) +
        (1 | stand/plot) + (1 | hareyr), data = hv, family = "nbinom")
    AIC: 8391.6
    Coefficients:
                              Estimate Std. Error z value Pr(>|z|)
    (Intercept)               -4.67230    0.17840  -26.19  < 2e-16 ***
    season[T.smr]             -0.23872    0.09559   -2.50  0.01251 *
    t.con.splgs                0.01686    0.00447    3.77  0.00016 ***
    season[T.smr]:t.con.splgs -0.01653    0.00402   -4.12  3.8e-05 ***


and
    ## prepare predictive dataframe:
    ## Conifer saplings, wi is winter intercept
    ##  and predict pellets based on square root transformed conifer
saplings/0.1 ha

    predctCSwi <- data.frame(
                  t.con.splgs = rep(seq(from = min(hv$t.con.splgs),
                                          to =
max(hv$t.con.splgs),length.out = 100),2),
                  ln.days=rep(log(30.25),200),   ###### account for month
                  season = factor(rep(1:2, each = 100),
                  levels = 1:2, labels=levels(hv$season)))

    predctCSwi <- cbind(predctCSwi, predict(wi.tconsplgs, predctCSwi, type
= "link", se.fit=TRUE))
    head(predctCSwi)
  t.con.splgs  ln.days season       fit    se.fit
1   0.0000000 3.409496    wtr -1.262801 0.1784000
2   0.7142493 3.409496    wtr -1.250759 0.1784448
3   1.4284985 3.409496    wtr -1.238718 0.1785467
4   2.1427478 3.409496    wtr -1.226676 0.1787054
5   2.8569971 3.409496    wtr -1.214635 0.1789210
6   3.5712464 3.409496    wtr -1.202593 0.1791931

# Then scale up to pellets/ha/month (phm)
#  and backtransform saplings to per 0.1 ha by squaring the square-root
values
    predctCSwi <- within(predctCSwi, {
       pellets <- exp(fit)
       phm <- pellets/1.5*10000
        LLha <- (exp(fit - 1.96 * se.fit))/1.5*10000
        ULha <- (exp(fit + 1.96 * se.fit))/1.5*10000
        con.splgs.1ha <- (t.con.splgs^2)
     })


Thank you,
Sheryn Olson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20141210/64ed1ef1/attachment.html>


More information about the Users mailing list