compute_vcov {cauphy}R Documentation

Compute Approximated Variance Covariance Matrix

Description

Find the approximated variance covariance matrix of the parameters.

Usage

compute_vcov(obj)

Arguments

obj

a fitted object, either with fitCauchy or cauphylm.

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.

Value

The same object, with added vcov entry.

See Also

fitCauchy, cauphylm, confint.cauphylm, confint.cauphyfit, vcov.cauphylm, vcov.cauphyfit

Examples

# Simulate tree and data
set.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 matrix
fit <- compute_vcov(fit)
# Approximate confidence intervals
confint(fit)


[Package cauphy version 1.0.2 Index]