Learn R Programming

AICcmodavg (version 1.35)

predictSE.zip: Computing Predicted Values and Standard Errors

Description

Function to compute predicted values and standard errors from output of N-mixture models for count data based on the zero-inflated Poisson of 'unmarkedFitPCount' or 'unmarkedFitPCO' classes.

Usage

predictSE.zip(mod, newdata, se.fit = TRUE, parm.type = "lambda",
              type = "response", c.hat = 1, print.matrix = FALSE)

Arguments

mod
an object of class 'unmarkedFitPCount' or 'unmarkedFitPCO' containing the output of a model.
newdata
a data frame with the same structure as that of the original data frame for which we want to make predictions.
se.fit
logical. If TRUE, compute standard errors on predictions.
parm.type
the parameter for which predictions are made based on the model. Currently, only predictions on abundance (i.e., parm.type = "lambda") is supported.
type
the scale of predicted values (response or link). Currently, only type = "response" is supported.
c.hat
value of overdispersion parameter (i.e., variance inflation factor) such as that obtained from 'Nmix.gof.test'. If c.hat > 1, 'predictSE.zip' will multiply the variance-covariance matrix of the predictions by this value (i.e., SE's are multi
print.matrix
logical. If TRUE, the output is returned as a matrix, with predicted values and standard errors in columns. If FALSE, the output is returned as a list.

Value

  • 'predictSE.zip' returns requested values either as a matrix ('print.matrix = TRUE') or list ('print.matrix = FALSE') with components:
  • fitthe predicted values.
  • se.fitthe standard errors of the predicted values (if 'se.fit = TRUE').

Details

'predictSE.zip' computes predicted values on abundance based on the estimates from an 'unmarkedFitPCount' or 'unmarkedFitPCO' object as well as the associated standard errors. Standard errors are approximated using the delta method (Oehlert 1992). If c.hat > 1, standard errors are adjusted by sqrt(c.hat).

References

Oehlert, G. W. (1992) A note on the delta method. American Statistician 46, 27--29.

See Also

modavgpred, pcount, pcountOpen, unmarkedFit-class

Examples

Run this code
if(require(unmarked)) {
##example with mallard data set from unmarked package
data(mallard)
mallardUMF <- unmarkedFramePCount(mallard.y, siteCovs = mallard.site,
                                  obsCovs = mallard.obs)
##run model with zero-inflated Poisson abundance
fm.mall.one <- pcount(~ ivel + date  ~ length + forest, mallardUMF, K=30,
                      mixture = "ZIP")
##make prediction
predictSE.zip(fm.mall.one, type = "response", parm.type = "lambda",
              newdata = data.frame(length = 0, forest = 0, elev = 0))
##compare against predict
predict(fm.mall.one, type = "state", backTransform = TRUE,
        newdata = data.frame(length = 0, forest = 0, elev = 0))

##add offset in model to scale abundance per transect length
fm.mall.off <- pcount(~ ivel + date  ~ forest + offset(length), mallardUMF, K=30,
                      mixture = "ZIP")
##make prediction
predictSE.zip(fm.mall.off, type = "response", parm.type = "lambda",
              newdata = data.frame(length = 10, forest = 0, elev = 0))
##compare against predict
predict(fm.mall.off, type = "state", backTransform = TRUE,
        newdata = data.frame(length = 10, forest = 0, elev = 0))
detach(package:unmarked)
}

Run the code above in your browser using DataLab