Learn R Programming

RAD (version 0.3)

predict.negBinMod: predict

Description

Predict values for N and E(N) given a model for N and new covariates.

Usage

## S3 method for class 'negBinMod' "predict"(object,new.obs,offset=1,...)

Arguments

object
a fitted model from negBinMod, of class negBinMod.
new.obs
new covariates used to predict N. Must contain the same names as in the formula for negBinMod
offset
Predict sample for an area of this dimension
...
additional arguments to be passed to predict

Value

N
predicted N
expect.N
expected N

Authors

Piers Dunstan and Scott Foster

Details

Uses mvtnorm to obtain new parameters for the glm using calculated variance-covariance matrix, assuming multivariate normal for parameters.

new.obs will be automatically scaled using details in model.N if scale.covar==TRUE

Examples

Run this code
N.form <- N~1  + depth + O2_AV + temp_AV + offset(log(area))
model.N <- negBinMod(N.form,data=fish.data,est.var=TRUE,scale.covar =FALSE)
N.pred <- rep(NA,100)
for(n in 1:100) N.pred[n] <- predict(model.N,fish.data[5,],offset=10)$N
hist(N.pred)

Run the code above in your browser using DataLab