getCoef: Extract Model Coefficients With Confidence Intervals

Description Usage Arguments Details Value Examples

Description

Extract all model coefficients with confidence intervals.

Usage

1
getCoef(object, conf.level, effects, format, add.type, ...)

Arguments

object

a lm, gls, lme, or lmm object.

conf.level

[numeric 0-1] Confidence level of the confidence intervals.

effects

[character vector] Type of coefficient to be output. Can be coefficients relative to the expectation of the outcome ("mean" or "fixed") or to the variance-covariance structure of the residuals ("variance").

format

[character] How the output should be shaped. Can be "default", "estimate", "publish", or "SAS".

add.type

[logical] Should the type of parameter be added.

...

argument passed to the publish function (when format="publish").

Details

Argument format:
Setting the argument to "default" outputs a data.frame with columns type (mean or covariance), term (name of the coefficient), estimate, std.error, t.value, p.value, lower, upper.

Setting the argument to "publish" outputs a data.frame with columns Variable, Units Coefficients, CI, and p-value. Call the function publish from the publish package.

Setting the argument to "estimate" outputs a vector containing the estimated parameter values.

Argument add.type:
When TRUE, there can be 4 types of parameters in the output:

Value

A data.frame or a vector (see details section)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
data(gastricbypassL, package = "LMMstar")
library(nlme)

#### linear model ####
## (wrong model as it does not account for repeated measurements)
e.lm <- lm(weight ~ time, data = gastricbypassL)

getCoef(e.lm)
getCoef(e.lm, format = "estimate")
getCoef(e.lm, effects = "variance")
getCoef(e.lm, effects = "variance", format = "estimate")
if(require(Publish)){
getCoef(e.lm, format = "publish")
}
getCoef(e.lm, format = "SAS")

#### gls model ####
e.gls <- gls(weight ~ time,
             correlation = corSymm(form =~as.numeric(visit)|id),
             weights = varIdent(form =~1|visit),
             data = gastricbypassL)
getCoef(e.gls)
getCoef(e.gls, effects = "variance")
getCoef(e.gls, effects = "variance", format = "estimate")
if(require(Publish)){
getCoef(e.gls, format = "publish")
}
getCoef(e.gls, format = "SAS")

#### lme model ####
e.lme <- lme(weight ~ time,
             random = ~1|id,
             weights = varIdent(form =~1|visit),
             data = gastricbypassL)
getCoef(e.lme)
getCoef(e.lme, effects = "variance")
getCoef(e.lme, effects = "variance", format = "estimate")
if(require(Publish)){
getCoef(e.lme, format = "publish")
}
getCoef(e.lme, format = "SAS")

LMMstar documentation built on Nov. 5, 2021, 1:07 a.m.