confint: Confidence Intervals for Model Parameters

Description Usage Arguments Value Author(s) See Also Examples

Description

Modified version of the confint function, which displays the coefficients in addition to the CIs, and allows for more control on display parameters. A plot argument and function allow to graph the coefficients and their CIs.

Usage

1
2
3
4
5
6
confint(object, parm, level = 0.95, order = FALSE, groups, plot = FALSE,
  ...)

## S3 method for class 'confint'
plot(x, mar = c(5, 7, 3, 1) + 0.1, col = NULL,
  main = attr(x, "model"), pch = 19, add.signif = FALSE, ...)

Arguments

order

Logical. If TRUE, the results are ordered by descending order on the coefficient value.

groups

A factor in the sense that as.factor(f) defines the groups, or a list of such factors in which case their interaction is used for the groups. See split.

plot

Whether to plot the results.

...

Further arguments passed to points.

x

A data.frame of class confint.

mar

The number of lines of margin, can be useful if the coefficient names do not fit in the left margin. See par for more details.

col

The color of each coefficient + CI; gray by default. If "groups", the color of each (sorted) group; use a hcl palette by default.

main

The title of the plot.

pch

The symbol to be used for the points. See par for more details.

add.signif

Logical, whether to add an asterik for variables with CIs non-overlapping with zero.

...

Further arguments passed to points.

Value

A data frame providing the CI and coefficients.

Author(s)

Mathieu Basille basille@ufl.edu

See Also

confint for more details on other parameters.

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
## Example of linear model
fit <- lm(100/mpg ~ disp + hp + wt + am, data = mtcars)
## Standard 'confint' function
stats::confint(fit)
## Same results with modified function
confint(fit)
## Argument 'level'
stats::confint(fit, level = .9)
confint(fit, level = .9)
## Argument 'order'
confint(fit, order = TRUE)
## Argument 'groups'
confint(fit, groups = c(3, 1, 1, 1, 2))
## Argument 'level', "'order' and 'groups' simultaneously
confint(fit, level = .9, order = TRUE, groups = c(3, 1, 1, 1, 2))
## Argument 'parm'
stats::confint(fit, "am")
confint(fit, "am")
##'
## Plot of the results
plot(confint(fit, order = TRUE, groups = c(3, 1, 1, 1, 2)))
confint(fit, order = TRUE, groups = c(3, 1, 1, 1, 2), plot = TRUE)
confint(fit, order = TRUE, groups = c(3, 1, 1, 1, 2), plot = TRUE,
    col = c("blue", "red", "green"), pch = 18, cex = 2)
confint(fit, order = TRUE, groups = c(3, 1, 1, 1, 2), level = 0.9,
    plot = TRUE, add.signif = TRUE)

basille/basr documentation built on May 11, 2019, 8:32 p.m.