Generic Methods for S3 class cauphylm.

# S3 method for cauphylm
print(x, digits = max(3, getOption("digits") - 3), ...)

# S3 method for cauphylm
vcov(object, ...)

# S3 method for cauphylm
logLik(object, ...)

# S3 method for logLik.cauphylm
AIC(object, k = 2, ...)

# S3 method for cauphylm
AIC(object, k = 2, ...)

# S3 method for cauphylm
predict(object, newdata = NULL, ...)

# S3 method for cauphylm
confint(object, parm, level = 0.95, ...)

# S3 method for cauphylm
coef(object, ...)

Arguments

x

an object of class "phylolm".

digits

number of digits to show in summary method.

...

further arguments to methods.

object

an object of class cauphylm.

k

numeric, the penalty per parameter to be used; the default k = 2 is the classical AIC.

newdata

an optional data frame to provide the predictor values at which predictions should be made. If omitted, the fitted values are used. Currently, predictions are made for new species whose placement in the tree is unknown. Only their covariate information is used. The prediction for the trend model is not currently implemented.

parm

a specification of which parameters are to be given confidence intervals, either a vector of numbers or a vector of names. If missing, all parameters are considered.

level

the confidence level required.

Value

Same value as the associated methods from the stats package:

vcov

an estimated covariance matrix, see compute_vcov;

logLik

an object of class logLik;

AIC

a numeric value;

confint

a matrix (or vector) with columns giving lower and upper confidence limits for each parameter;

coef

coefficients extracted from the model;

predict

a vector of predicted values.

Examples

# Simulate tree and data
set.seed(1289)
phy <- ape::rphylo(20, 0.1, 0)
error <- rTraitCauchy(n = 1, phy = phy, model = "cauchy",
                      parameters = list(root.value = 0, disp = 0.1))
x1 <- ape::rTraitCont(phy, model = "BM", sigma = 0.1, root.value = 0)
trait <- 3 + 2*x1 + error
# Fit the data
fit <- cauphylm(trait ~ x1, phy = phy)
fit
#> Call:
#> cauphylm(formula = trait ~ x1, phy = phy)
#> 
#>    AIC logLik 
#>   77.8  -35.9 
#> 
#> Parameter estimate(s) using ML:
#> dispersion: 0.05249818 
#> 
#> Coefficients:
#> (Intercept)          x1 
#>    2.005913    1.421920 
# vcov matrix
vcov(fit)
#>              (Intercept)           x1         disp
#> (Intercept) 0.6470977107 0.1291299896 0.0009311013
#> x1          0.1291299896 0.1399242443 0.0002061902
#> disp        0.0009311013 0.0002061902 0.0002891545
# Approximate confidence intervals
confint(fit)
#> Approximated asymptotic confidence interval using the Hessian.
#>                  2.5 %     97.5 %
#> (Intercept) 0.42927112 3.58255462
#> x1          0.68876658 2.15507244
#> disp        0.01916989 0.08582647
# log likelihood of the fitted object
logLik(fit)
#> 'log Lik.' -35.89783 (df=3)
# AIC of the fitted object
AIC(fit)
#> [1] 77.79565
# predicted values
predict(fit)
#>        t1        t2        t3        t4        t5        t6        t7        t8 
#> 0.7028928 1.5519815 1.7258657 1.7662845 1.2772374 1.8690039 2.1319177 2.0970362 
#>        t9       t10       t11       t12       t13       t14       t15       t16 
#> 1.1722677 1.9586478 1.6825041 1.6882501 2.2393014 1.9425933 1.8442025 2.2179683 
#>       t17       t18       t19       t20 
#> 1.5230505 2.2757195 1.0490475 1.3168765 
# coefficients
coef(fit)
#> (Intercept)          x1        disp 
#>  2.00591287  1.42191951  0.05249818