methods.matreg: Extractor Functions for 'matreg' Objects

coef.matregR Documentation

Extractor Functions for 'matreg' Objects

Description

Various extractor functions for objects of class "matreg". \loadmathjax

Usage

## S3 method for class 'matreg'
coef(object, ...)
## S3 method for class 'matreg'
vcov(object, ...)
## S3 method for class 'matreg'
sigma(object, REML=TRUE, ...)

## S3 method for class 'matreg'
logLik(object, REML=FALSE, ...)
## S3 method for class 'matreg'
AIC(object, ..., k=2, correct=FALSE, REML=FALSE)
## S3 method for class 'matreg'
BIC(object, ..., REML=FALSE)

## S3 method for class 'matreg'
confint(object, parm, level, digits, ...)
## S3 method for class 'confint.matreg'
print(x, digits=x$digits, ...)

Arguments

object

an object of class "matreg".

REML

logical whether the returned value should be based on ML or REML estimation.

k

numeric value to specify the penalty per parameter. The default (k=2) is the classical AIC. See AIC for more details.

correct

logical to specify whether the regular (default) or corrected (i.e., AICc) should be extracted.

For confint():

parm

this argument is here for compatibility with the generic function confint, but is (currently) ignored.

level

numeric value between 0 and 100 to specify the confidence interval level (see here for details). If unspecified, the default is to take the value from the object.

digits

optional integer to specify the number of decimal places to which the results should be rounded. If unspecified, the default is to take the value from the object.

x

an object of class "confint.matreg".

...

other arguments.

Details

The coef function extracts the estimated (standardized) regression coefficients from objects of class "matreg". The vcov function extracts the corresponding variance-covariance matrix (note: the se function can also be used to extract the standard errors). The confint function extracts the confidence intervals.

Under the ‘Regular \mjseqnR Matrix’ case (see matreg), the sigma function extracts the square root of the estimated error variance (by default, based on the unbiased estimate of the error variance). The logLik, AIC, and BIC functions extract the corresponding values (note: for compatibility with the behavior for lm objects, these values are based by default on ML estimation).

Value

Depending on the function, either a vector, a matrix, or a scalar with the extracted value(s).

Author(s)

Wolfgang Viechtbauer (wvb@metafor-project.org, https://www.metafor-project.org).

References

Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. Journal of Statistical Software, 36(3), 1–48. ⁠https://doi.org/10.18637/jss.v036.i03⁠

See Also

matreg for the function to create matreg objects and predict.matreg to compute predicted values based on matreg objects.

Examples

### fit a regression model with lm() to the 'mtcars' dataset
res <- lm(mpg ~ hp + wt + am, data=mtcars)
summary(res)
coef(res)
vcov(res)
se(res)
sigma(res)
confint(res)
logLik(res)
AIC(res)
BIC(res)

### covariance matrix of the dataset
S <- cov(mtcars)

### fit the same regression model using matreg()
res <- matreg(mpg ~ hp + wt + am, R=S, cov=TRUE,
              means=colMeans(mtcars), n=nrow(mtcars))
summary(res)
coef(res)
vcov(res)
se(res)
sigma(res)
confint(res)
logLik(res)
AIC(res)
BIC(res)

metafor documentation built on Sept. 15, 2026, 5:09 p.m.