Learn R Programming

unmarked (version 1.4.3)

predict-methods: Methods for Function predict in Package `unmarked'

Description

These methods return predicted values from fitted model objects.

Arguments

Methods

signature(object = "unmarkedFit")

"type" must be either `state' or `det'.

signature(object = "unmarkedFitColExt")

"type" must be 'psi', 'col', 'ext', or 'det'.

signature(object = "unmarkedFitGMM")

"type" must be 'lambda', 'psi', 'det'

signature(object = "unmarkedFitList")

"type" depends upon the fitted models

signature(object = "unmarkedRanef")

Use this method to generate the empirical Bayes posterior predictive distribution for functions of the random variables (latent abundance or occurrence).

In addition to the output object from ranef, you must also supply a custom function to argument func. The function must take as input a matrix with dimensions M x T, where M is the number of sites and T is the number of primary periods (T=1 for single-season models). The output of this function should be a vector or matrix containing the derived parameters of interest.

You may also manually set the number of draws from the posterior predictive distribution with argument nsims; the default is 100.

The output of predict will be a vector or array with one more dimension than the output of the function supplied func, corresponding to the number of draws requested nsims. For example, if func outputs a scalar, the output of predict will be a vector with length equal to nsims. If func outputs a 3x2 matrix, the output of predict will be an array with dimensions 3x2xnsims. See ranef for an example.

Alternatively, you can use the posteriorSamples function on the ranef output object to obtain the full posterior predictive distribution. This is useful if you are having trouble designing your custom function or if you want to obtain multiple different derived parameters from the same posterior predictive distribution.