Computes real estimates and their var-cov for a particular parameter.
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
)
A data frame (real
) is returned if vcv=FALSE
;
otherwise, a list is returned also containing vcv.real:
data frame containing estimates, and if vcv=TRUE it also contains standard errors and confidence intervals
variance-covariance matrix of real estimates
model object
name of real parameter to be computed (eg "Phi" or "p")
list of design data
design matrix list
TRUE if only unique values should be returned unless non-NULL subset is specified
logical; if TRUE, computes and returns v-c matrix of real estimates
logical; if TRUE, computes std errors and conf itervals of real estimates
over-dispersion value
logical expression using fields in real dataframe; if used gives all estimates which ignores unique=TRUE
character vector of field names in real that you want to include
if TRUE, show design matrix instead of data
vector of field names always to be included even when select or unique specified
default FALSE; if TRUE uses link values in evaluating uniqueness
default FALSE but if TRUE, the ddl for the parameter is merged (cbind) to the estimates but only if unique=FALSE
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
Jeff Laake
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).
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)
Run the code above in your browser using DataLab