predict.crm {marked} | R Documentation |
Compute estimates of real parameters
Description
Computes real estimates and their var-cov for a particular subset of parameters. The argument newdata may not work with all models. A better approach to compute real estimates for a subset of values or a new set of values is to specify a limited range of the values in ddl for each parameter. Make sure to include a complete set of values that spans the factor levels and individual covariates used in the formulas for the model object or you will receive an error that the number of columns in the design matrix does not match the number of beta parameters. You cannot change the levels of any factor variable or modify the design data in anyway that changes the design matrix.
Usage
## S3 method for class 'crm'
predict(object,newdata=NULL,ddl=NULL,parameter=NULL,unique=TRUE,
vcv=FALSE,se=FALSE,chat=1,subset=NULL,select=NULL,
real.ids=NULL,merge=FALSE,unit_scale=TRUE,...)
Arguments
object |
model object; |
newdata |
a dataframe for crm |
ddl |
list of dataframes for design data; if specified forces computation even if estimates are in model object |
parameter |
name of real parameter to be computed (eg "Phi") |
unique |
TRUE if only unique values should be returned; if TRUE forces computation even if estimates are in model object |
vcv |
logical; if TRUE, computes and returns v-c matrix of real estimates; if TRUE forces computation even if estimates are in model object |
se |
logical; if TRUE, computes std errors and conf itervals of real estimates |
chat |
over-dispersion value |
subset |
logical expression using fields in real dataframe |
select |
character vector of field names in real that you want to include |
real.ids |
animal ids passed to TMB code for computation of real parameter values |
merge |
default FALSE but if TRUE, the ddl for the parameter is merged (cbind) to the estimates |
unit_scale |
default TRUE, if FALSE any time scaled parameter (e.g. Phi,S) is scaled when computing real value such that it represents the length of the interval rather than a unit interval |
... |
generic arguments not used here |
Details
If the real estimates are in the model object and se and vcv are FALSE and ddl not specified, the code will simply pull the values from the model object.
Value
A data frame (real
) is returned if vcv=FALSE
;
otherwise, a list is returned also containing vcv.real:
real |
data frame containing estimates, and if vcv=TRUE it also contains standard errors and confidence intervals |
vcv.real |
variance-covariance matrix of real estimates |
Author(s)
Jeff Laake
Examples
data(dipper)
dipper.proc=process.data(dipper,model="cjs",begin.time=1)
dipper.ddl=make.design.data(dipper.proc)
mod.Phisex.pdot=crm(dipper.proc,dipper.ddl,
model.parameters=list(Phi=list(formula=~sex+time),p=list(formula=~1)),hessian=TRUE)
xx=predict(mod.Phisex.pdot,ddl=dipper.ddl)
xx
xx=predict(mod.Phisex.pdot,newdata=dipper[c(1,23),],vcv=TRUE)
xx