confint2.default {quest} | R Documentation |
Confidence Intervals from Parameter Estimates and Standard Errors
Description
confint2.default
is the default method for the generic function
confint2
and computes the statistical information for confidence
intervals from parameter estimates, standard errors, and degrees of freedom.
If degrees of freedom are not applicable or available, then df
can be
set to Inf
(the default) and critical z-values rather than critical
t-values will be used.
Usage
## Default S3 method:
confint2(obj, se, df = Inf, level = 0.95, ...)
Arguments
obj |
numeric vector of parameter estimates. A better name for this
argument would be |
se |
numeric vector of standard errors. Must be the same length as
|
df |
numeric vector of degrees of freedom. Must have length 1 or the
same length as |
level |
double vector of length 1 specifying the confidence level. Must be between 0 and 1. |
... |
This argument has no use. Technically, it is additional arguments
for |
Value
data.frame with nrow equal to the lengths of obj
and
se
. The rownames are taken from obj
, unless obj
does not
have any names and then the rownames are taken from the names of se
.
If neither have names, then the rownames are automatic (i.e.,
1:nrow()
). The columns are the following:
- est
parameter estimates
- se
standard errors
- lwr
lower bound of the confidence intervals
- upr
upper bound of the confidence intervals
See Also
Examples
# single estimate
confint2.default(obj = 10, se = 3)
# multiple estimates
est <- colMeans(attitude)
se <- apply(X = str2str::d2m(attitude), MARGIN = 2, FUN = function(vec)
sqrt(var(vec) / length(vec)))
df <- nrow(attitude) - 1
confint2.default(obj = est, se = se, df = df)
confint2.default(obj = est, se = se) # default is df = Inf and use of ctitical z-values
confint2.default(obj = est, se = se, df = df, level = 0.99)
# error
## Not run:
confint2.default(obj = c(10, 12), se = c(3, 4, 5))
## End(Not run)