confint.gkwfit | R Documentation |
Computes confidence intervals for one or more parameters in a model fitted by
gkwfit
. It uses the Wald method based on the estimated coefficients
and their standard errors derived from the variance-covariance matrix.
## S3 method for class 'gkwfit'
confint(object, parm, level = 0.95, ...)
object |
An object of class |
parm |
A specification of which parameters are to be given confidence intervals, either a vector of numbers (indices) or a vector of names. If missing, confidence intervals are computed for all parameters that have a valid standard error available. Parameter indices refer to the order of parameters for which standard errors could be calculated. |
level |
The confidence level required (default: 0.95). |
... |
Additional arguments (currently ignored). |
This function calculates confidence intervals using the Wald method:
Estimate \pm z \times SE
, where z
is the appropriate quantile
from the standard normal distribution for the given confidence level
.
It relies on the results from coef.gkwfit
and vcov.gkwfit
(or directly accesses object$coefficients
and object$vcov
if those
methods aren't defined). It checks for the validity of the variance-covariance
matrix before proceeding.
Since all parameters of the GKw family distributions are constrained to be positive,
the lower bound of the confidence interval is truncated at a small positive value
(.Machine$double.eps^0.5
) if the calculated lower bound is non-positive.
If parm
is specified, it selects the parameters for which to compute intervals.
Numeric indices in parm
refer to the parameters that have calculable standard
errors, not necessarily all parameters in the model (if some were fixed or had
estimation issues).
A matrix with columns giving lower and upper confidence limits for each
parameter specified in parm
. The columns are labeled with quantile percentages
(e.g., "2.5 %"
and "97.5 %"
for level = 0.95
). Row names
are taken from the parameter names. Returns NULL
or stops with an error
if coefficients or a valid variance-covariance matrix cannot be extracted.
Lopes, J. E.
gkwfit
, confint
, coef.gkwfit
, vcov.gkwfit
# Generate data and fit model
set.seed(2203)
y <- rkw(50, alpha = 2, beta = 3)
fit <- gkwfit(data = y, family = "kw", plot = FALSE, hessian = TRUE)
# Calculate confidence intervals for all parameters
ci <- confint(fit)
print(ci)
# 90% confidence interval
ci_90 <- confint(fit, level = 0.90)
print(ci_90)
# Confidence interval for specific parameter
ci_alpha <- confint(fit, parm = "alpha")
print(ci_alpha)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.