compute_real: Compute estimates of real parameters

View source: R/compute.real.R

compute_realR Documentation

Compute estimates of real parameters

Description

Computes real estimates and their var-cov for a particular parameter.

Usage

compute_real(
  model,
  parameter,
  ddl = NULL,
  dml = NULL,
  unique = TRUE,
  vcv = FALSE,
  se = FALSE,
  chat = 1,
  subset = NULL,
  select = NULL,
  showDesign = FALSE,
  include = NULL,
  uselink = FALSE,
  merge = FALSE,
  unit_scale = TRUE
)

Arguments

model

model object

parameter

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

ddl

list of design data

dml

design matrix list

unique

TRUE if only unique values should be returned unless non-NULL subset is specified

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; if used gives all estimates which ignores unique=TRUE

select

character vector of field names in real that you want to include

showDesign

if TRUE, show design matrix instead of data

include

vector of field names always to be included even when select or unique specified

uselink

default FALSE; if TRUE uses link values in evaluating uniqueness

merge

default FALSE but if TRUE, the ddl for the parameter is merged (cbind) to the estimates but only if unique=FALSE

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

Details

This code is complicated because it handles both the MCMC models and the likelihood models. The former is quite simple than the latter because all of the real computation is done by the model code and this function only computes summaries. The likelihood model code is complicated primarily by the mlogit parameters which are computed in 2 stages: 1) log link and 2) summation to normalize. The mlogit is handled differently depending on the model. For MS and JS models, one of the parameters is computed by subtraction (specified as addone==TRUE) whereas the HMM models (addone=FALSE) specify a parameter for each cell and one is fixed by the user to 1. The latter is preferable because it then provides an estimate and a std error for each parameter whereas the subtracted value is not provided for MS and JS.

This function differs from compute.real in RMark because it only computes the values for a single parameter whereas the function with the same name in RMark can compute estimates from multiple parameters (eg Phi and p).

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=compute_real(mod.Phisex.pdot,"Phi",unique=TRUE,vcv=TRUE)

marked documentation built on Oct. 19, 2023, 5:06 p.m.