Find the approximated variance covariance matrix of the parameters.
compute_vcov(obj)
Arguments
obj: a fitted object, either with fitCauchy or cauphylm.
Returns
The same object, with added vcov entry.
Details
This function computes the numerical Hessian of the likelihood at the optimal value using function hessian, and then uses its inverse to approximate the variance covariance matrix. It can be used to compute confidence intervals with functions confint.cauphylm
or confint.cauphyfit.
confint.cauphylm and confint.cauphyfit
internally call compute_vcov, but do not save the result. This function can be used to save the vcov matrix.
Examples
# Simulate tree and dataset.seed(1289)phy <- ape::rphylo(20,0.1,0)dat <- rTraitCauchy(n =1, phy = phy, model ="cauchy", parameters = list(root.value =10, disp =0.1))# Fit the data, without computing the Hessian at the estimated parameters.fit <- fitCauchy(phy, dat, model ="cauchy", method ="reml", hessian =FALSE)# Precompute the vcov matrixfit <- compute_vcov(fit)# Approximate confidence intervalsconfint(fit)