Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 42f94fc
  • /
  • man
  • /
  • ci.Rd
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge
swh:1:cnt:6323a88631d640af4e026a2e1ada4d7126685eb6
directory badge
swh:1:dir:6e625a798bfb123b63e7563d8f4b9140f7033c96

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
ci.Rd
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ci.R
\name{ci}
\alias{ci}
\alias{ci.numeric}
\alias{ci.data.frame}
\alias{ci.emmGrid}
\alias{ci.sim.merMod}
\alias{ci.sim}
\alias{ci.stanreg}
\alias{ci.brmsfit}
\alias{ci.BFBayesFactor}
\alias{ci.MCMCglmm}
\title{Confidence/Credible/Compatibility Interval (CI)}
\usage{
ci(x, ...)

\method{ci}{numeric}(x, ci = 0.89, method = "ETI", verbose = TRUE, BF = 1, ...)

\method{ci}{data.frame}(x, ci = 0.89, method = "ETI", verbose = TRUE, BF = 1, ...)

\method{ci}{emmGrid}(x, ci = 0.89, method = "ETI", verbose = TRUE, BF = 1, ...)

\method{ci}{sim.merMod}(
  x,
  ci = 0.89,
  method = "ETI",
  effects = c("fixed", "random", "all"),
  parameters = NULL,
  verbose = TRUE,
  ...
)

\method{ci}{sim}(x, ci = 0.89, method = "ETI", parameters = NULL, verbose = TRUE, ...)

\method{ci}{stanreg}(
  x,
  ci = 0.89,
  method = "ETI",
  effects = c("fixed", "random", "all"),
  parameters = NULL,
  verbose = TRUE,
  BF = 1,
  ...
)

\method{ci}{brmsfit}(
  x,
  ci = 0.89,
  method = "ETI",
  effects = c("fixed", "random", "all"),
  component = c("conditional", "zi", "zero_inflated", "all"),
  parameters = NULL,
  verbose = TRUE,
  BF = 1,
  ...
)

\method{ci}{BFBayesFactor}(x, ci = 0.89, method = "ETI", verbose = TRUE, BF = 1, ...)

\method{ci}{MCMCglmm}(x, ci = 0.89, method = "ETI", verbose = TRUE, ...)
}
\arguments{
\item{x}{A \code{stanreg} or \code{brmsfit} model, or a vector representing a posterior distribution.}

\item{...}{Currently not used.}

\item{ci}{Value or vector of probability of the CI (between 0 and 1)
to be estimated. Default to \code{.89} (89\%) for Bayesian models and \code{.95} (95\%) for frequentist models.}

\item{method}{Can be \link[=eti]{'ETI'} (default), \link[=hdi]{'HDI'} or \link[=si]{'SI'}.}

\item{verbose}{Toggle off warnings.}

\item{BF}{The amount of support required to be included in the support interval.}

\item{effects}{Should results for fixed effects, random effects or both be returned?
Only applies to mixed models. May be abbreviated.}

\item{parameters}{Regular expression pattern that describes the parameters that
should be returned. Meta-parameters (like \code{lp__} or \code{prior_}) are
filtered by default, so only parameters that typically appear in the
\code{summary()} are returned. Use \code{parameters} to select specific parameters
for the output.}

\item{component}{Should results for all parameters, parameters for the conditional model
or the zero-inflated part of the model be returned? May be abbreviated. Only
applies to \pkg{brms}-models.}
}
\value{
A data frame with following columns:
  \itemize{
    \item \code{Parameter} The model parameter(s), if \code{x} is a model-object. If \code{x} is a vector, this column is missing.
    \item \code{CI} The probability of the credible interval.
    \item \code{CI_low}, \code{CI_high} The lower and upper credible interval limits for the parameters.
  }
}
\description{
Compute Confidence/Credible/Compatibility Intervals (CI) or Support Intervals (SI) for Bayesian and frequentist models. The Documentation is accessible for:
}
\details{
\itemize{
 \item \href{https://easystats.github.io/bayestestR/articles/credible_interval.html}{Bayesian models}
 \item \href{https://easystats.github.io/parameters/reference/ci.merMod.html}{Frequentist models}
}
}
\note{
When it comes to interpretation, we recommend thinking of the CI in terms of
  an "uncertainty" or "compatibility" interval, the latter being defined as
  \dQuote{Given any value in the interval and the background assumptions,
  the data should not seem very surprising} (\cite{Gelman & Greenland 2019}).
  \cr \cr
  There is also a \href{https://easystats.github.io/see/articles/bayestestR.html}{\code{plot()}-method} implemented in the \href{https://easystats.github.io/see/}{\pkg{see}-package}.
}
\examples{
library(bayestestR)

posterior <- rnorm(1000)
ci(posterior, method = "ETI")
ci(posterior, method = "HDI")

df <- data.frame(replicate(4, rnorm(100)))
ci(df, method = "ETI", ci = c(.80, .89, .95))
ci(df, method = "HDI", ci = c(.80, .89, .95))

\dontrun{
if (require("rstanarm")) {
  model <- stan_glm(mpg ~ wt, data = mtcars, chains = 2, iter = 200, refresh = 0)
  ci(model, method = "ETI", ci = c(.80, .89))
  ci(model, method = "HDI", ci = c(.80, .89))
  ci(model, method = "SI")
}

if (require("brms")) {
  model <- brms::brm(mpg ~ wt + cyl, data = mtcars)
  ci(model, method = "ETI")
  ci(model, method = "HDI")
  ci(model, method = "SI")
}

if (require("BayesFactor")) {
  bf <- ttestBF(x = rnorm(100, 1, 1))
  ci(bf, method = "ETI")
  ci(bf, method = "HDI")
}

if (require("emmeans")) {
  model <- emtrends(model, ~1, "wt")
  ci(model, method = "ETI")
  ci(model, method = "HDI")
  ci(model, method = "SI")
}
}
}
\references{
Gelman A, Greenland S. Are confidence intervals better termed "uncertainty intervals"? BMJ 2019;l5381. \doi{10.1136/bmj.l5381}
}

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API