coef.matreg | R Documentation |
Methods for objects of class "matreg"
.
## S3 method for class 'matreg'
coef(object, ...)
## S3 method for class 'matreg'
vcov(object, ...)
object |
an object of class |
... |
other arguments. |
The coef
function extracts the estimated model coefficients from objects of class "matreg"
. The vcov
function extracts the corresponding variance-covariance matrix.
Either a vector with the estimated model coefficients or a variance-covariance matrix.
Wolfgang Viechtbauer wvb@metafor-project.org https://www.metafor-project.org
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
matreg
for the function to create matreg
objects.
### fit a regression model with lm() to the 'mtcars' dataset
res <- lm(mpg ~ hp + wt + am, data=mtcars)
coef(res)
vcov(res)
### covariance matrix of the dataset
S <- cov(mtcars)
### fit the same regression model using matreg()
res <- matreg(y="mpg", x=c("hp","wt","am"), R=S, cov=TRUE,
means=colMeans(mtcars), n=nrow(mtcars))
coef(res)
vcov(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.