| predict-methods {unmarked} | R Documentation |
Methods for Function predict in Package ‘unmarked’
Description
These methods return predicted values from fitted model objects.
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 argumentfunc. 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
predictwill be a vector or array with one more dimension than the output of the function suppliedfunc, corresponding to the number of draws requestednsims. For example, iffuncoutputs a scalar, the output ofpredictwill be a vector with length equal tonsims. Iffuncoutputs a 3x2 matrix, the output ofpredictwill be an array with dimensions 3x2xnsims. Seeraneffor an example.Alternatively, you can use the
posteriorSamplesfunction on theranefoutput 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.