predict.crm: Compute estimates of real parameters

Description Usage Arguments Value Author(s) Examples

View source: R/predict.crm.r

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

1
2
3
4
## 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,...)

Arguments

object

model object;

newdata

a dataframe for crm

ddl

list of dataframes for design data

parameter

name of real parameter to be computed (eg "Phi")

unique

TRUE if only unique values should be returned

vcv

logical; if TRUE, computes and returns v-c matrix of real estimates

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

...

generic arguments not used here

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

1
2
3
4
5
6
7
8
9
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

Example output

Loading required package: lme4
Loading required package: Matrix
Loading required package: parallel
This is marked 1.2.6

255 capture histories collapsed into 53
Computing initial parameter estimates

Starting optimization for 8 parameters...

 Number of evaluations:  100  -2lnl:   659.65562
 Number of evaluations:  200  -2lnl: 659.6494517
 Number of evaluations:  300  -2lnl: 659.9122793
 Number of evaluations:  400  -2lnl: 659.6533877
 Number of evaluations:  500  -2lnl: 660.1915964Computing hessian...

 Number of evaluations:  100  -2lnl: 659.7222552
 Number of evaluations:  200  -2lnl: 659.6497384
Elapsed time in minutes:  0.0073 

$Phi
      sex time occ  estimate
1  Female    6   6 0.5762781
2    Male    6   6 0.5901055
3  Female    5   5 0.6010941
4    Male    5   5 0.6146532
5  Female    4   4 0.6179089
6    Male    4   4 0.6312471
7  Female    3   3 0.4717224
8    Male    3   3 0.4859181
9  Female    2   2 0.4480346
10   Male    2   2 0.4621411
11 Female    1   1 0.6184402
12   Male    1   1 0.6317710

$p
  occ  estimate
1   7 0.9021693

$Phi
$Phi$real
      sex time occ  estimate         se       lcl       ucl
1  Female    1   1 0.6184402 0.11542967 0.3832363 0.8087178
2  Female    2   2 0.4480346 0.06990141 0.3180764 0.5855008
3  Female    3   3 0.4717224 0.06288907 0.3525467 0.5942110
4  Female    4   4 0.6179089 0.06177880 0.4919546 0.7297882
5  Female    5   5 0.6010941 0.06018053 0.4795366 0.7113503
6  Female    6   6 0.5762781 0.06246351 0.4516838 0.6918741
7    Male    1   1 0.6317710 0.11284235 0.3986979 0.8161589
8    Male    2   2 0.4621411 0.07242222 0.3267789 0.6033249
9    Male    3   3 0.4859181 0.06423721 0.3634637 0.6100868
10   Male    4   4 0.6312471 0.06150679 0.5049180 0.7418237
11   Male    5   5 0.6146532 0.05937495 0.4938953 0.7227712
12   Male    6   6 0.5901055 0.06176023 0.4660395 0.7036739

$Phi$vcv
               1             2             3             4             5
1   0.0133240082  0.0003550590  0.0006417084  0.0006440674  0.0006756724
2   0.0003550590  0.0048862068  0.0003717505  0.0005208479  0.0005476461
3   0.0006417084  0.0003717505  0.0039550352  0.0003968623  0.0005772300
4   0.0006440674  0.0005208479  0.0003968623  0.0038166206  0.0003869573
5   0.0006756724  0.0005476461  0.0005772300  0.0003869573  0.0036216962
6   0.0007930002  0.0006135543  0.0006180474  0.0006253674  0.0004800966
7   0.0119284447 -0.0006563508 -0.0004555194 -0.0004259169 -0.0004531772
8  -0.0009330160  0.0038359367 -0.0007890158 -0.0006100099 -0.0006454932
9  -0.0006530462 -0.0007080009  0.0027961310 -0.0007413384 -0.0006232644
10 -0.0005729401 -0.0004934705 -0.0006975255  0.0027013893 -0.0007384513
11 -0.0005616873 -0.0004836743 -0.0005377001 -0.0006978801  0.0024379167
12 -0.0004696713 -0.0004386098 -0.0005191745 -0.0004835627 -0.0006882047
               6             7             8             9            10
1   0.0007930002  0.0119284447 -0.0009330160 -0.0006530462 -0.0005729401
2   0.0006135543 -0.0006563508  0.0038359367 -0.0007080009 -0.0004934705
3   0.0006180474 -0.0004555194 -0.0007890158  0.0027961310 -0.0006975255
4   0.0006253674 -0.0004259169 -0.0006100099 -0.0007413384  0.0027013893
5   0.0004800966 -0.0004531772 -0.0006454932 -0.0006232644 -0.0007384513
6   0.0039016897 -0.0003606486 -0.0006039726 -0.0006071968 -0.0005265514
7  -0.0003606486  0.0127333959  0.0003805147  0.0005887782  0.0005542166
8  -0.0006039726  0.0003805147  0.0052449773  0.0006053696  0.0006996891
9  -0.0006071968  0.0005887782  0.0006053696  0.0041264197  0.0005024202
10 -0.0005265514  0.0005542166  0.0006996891  0.0005024202  0.0037830856
11 -0.0006889152  0.0005435662  0.0006863024  0.0006392827  0.0004099071
12  0.0026770900  0.0006549988  0.0007537338  0.0006800989  0.0006419373
              11            12
1  -0.0005616873 -0.0004696713
2  -0.0004836743 -0.0004386098
3  -0.0005377001 -0.0005191745
4  -0.0006978801 -0.0004835627
5   0.0024379167 -0.0006882047
6  -0.0006889152  0.0026770900
7   0.0005435662  0.0006549988
8   0.0006863024  0.0007537338
9   0.0006392827  0.0006800989
10  0.0004099071  0.0006419373
11  0.0035253845  0.0004584951
12  0.0004584951  0.0038143265


$p
$p$real
  occ  estimate         se       lcl      ucl
1   2 0.9021693 0.02902917 0.8287663 0.946151

$p$vcv
             1
1 0.0008426928

marked documentation built on Dec. 9, 2019, 9:06 a.m.