| ci_cat | R Documentation |
Computes Wald-based confidence intervals for the transition probability parameters of a fitted categorical antedependence model.
ci_cat(fit, y = NULL, level = 0.95, parameters = "all")
fit |
A fitted model object of class |
y |
Optional data matrix. If NULL, |
level |
Confidence level (default 0.95). |
parameters |
Which parameters to compute CIs for: "all" (default), "marginal", or "transition". |
Confidence intervals are computed using the Wald method based on the asymptotic normality of maximum likelihood estimators.
For a probability estimate \hat{\pi} based on count N, the standard error is:
SE(\hat{\pi}) = \sqrt{\frac{\hat{\pi}(1-\hat{\pi})}{N}}
For conditional probabilities \hat{\pi}_{j|i} based on conditioning count
N_i, the standard error is:
SE(\hat{\pi}_{j|i}) = \sqrt{\frac{\hat{\pi}_{j|i}(1-\hat{\pi}_{j|i})}{N_i}}
The confidence interval is then:
\hat{\pi} \pm z_{\alpha/2} \times SE(\hat{\pi})
Note: CIs are truncated to the interval from 0 to 1 when they exceed these bounds.
Missing-data fits with na_action = "marginalize" are not currently
supported because observed cell counts are not stored for that path.
A list of class "cat_ci" containing:
marginal |
Data frame of CIs for marginal parameters (if requested) |
transition |
List of data frames of CIs for transition parameters (if requested) |
level |
Confidence level used |
settings |
Model settings from fit |
Agresti, A. (2013). Categorical Data Analysis (3rd ed.). Wiley.
fit_cat
# Fit a model
set.seed(123)
y <- simulate_cat(200, 5, order = 1, n_categories = 2)
fit <- fit_cat(y, order = 1)
# Compute confidence intervals
ci <- ci_cat(fit)
print(ci)
# Just marginal CIs
ci_marg <- ci_cat(fit, parameters = "marginal")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.