is an option for LinearModelFit and other fitting functions that specifies the level to use in various confidence and prediction intervals and bands.
ConfidenceLevel
is an option for LinearModelFit and other fitting functions that specifies the level to use in various confidence and prediction intervals and bands.
Details
- ConfidenceLevel affects values of properties related to confidence intervals.
- The default setting gives 95% confidence intervals.
- The value should be a number between 0 and 1.
- For certain types of models, model[…][prop,ConfidenceLevel->c] can be used to extract properties for a specified confidence level. »
Examples
open all close allBasic Examples (2)
Perform a linear fit and set the default confidence level to 99%:
lm = LinearModelFit[{...}, x, x, ConfidenceLevel -> 0.99]Obtain the mean prediction bands at this level:
lm["BestFitAround"]Set the confidence level when querying the prediction bands after fitting:
nlm = NonlinearModelFit[{...}, a Exp[b x], {a, b}, x]nlm["BestFitAround", ConfidenceLevel -> 0.9]Scope (3)
Compute the parameter confidence intervals at various confidence levels:
data = {{0, 1}, {1, 0}, {3, 2}, {5, 4}};lm = LinearModelFit[data, x, x]Estimates at the default 95% level:
lm["ParameterEstimates"]//Query[All, {"BasisFunction", "ConfidenceInterval"}]lm["ParameterEstimates", ConfidenceLevel -> .9]//Query[All, {"BasisFunction", "ConfidenceInterval"}]Set confidence level for a nonlinear model:
data = Table[{x, 3 Sin[2x] + RandomReal[{-.2, .2}]}, {x, RandomReal[5, 10]}];nlm = NonlinearModelFit[data, a Sin[b x], {a, b}, x, ConfidenceLevel -> .9]nlm["ParameterConfidenceIntervalTable"]Using the usual default level:
nlm["ParameterConfidenceIntervalTable", ConfidenceLevel -> .95]For a generalized linear model:
data = {{0, 1}, {1, 1.5}, {3, 2}, {5, 4}};glm = GeneralizedLinearModelFit[data, x, x, ExponentialFamily -> "InverseGaussian"]glm["ParameterConfidenceIntervalTable", ConfidenceLevel -> .99]Applications (1)
SeedRandom[1];
data = Table[{x, 1.2 Sin[2 x] + RandomReal[{-.2, .2}]}, {x, 10}]nlm = NonlinearModelFit[data, a Sin[b x], {a, b}, x]Obtain confidence intervals at several levels for comparison:
intervals = Table[Thread@{p, Interval /@ nlm["ParameterConfidenceIntervals", ConfidenceLevel -> p]}, {p, {.8, .85, .9, .95, .99}}]Plot the intervals versus the confidence levels:
ListPlot[Transpose[intervals], PlotLegends -> {a, b}, PlotTheme -> "Detailed", FrameLabel -> {"ConfidenceLevel", "ConfidenceInterval"}]Properties & Relations (1)
ConfidenceLevel affects all confidence intervals in FittedModel properties:
lm = LinearModelFit[Range[5], x ^ 2, x]Intervals using default 95% level:
Query[All, All, "ConfidenceInterval"]@lm[{"MeanPredictions", "SinglePredictions", "ParameterEstimates"}]Query[All, All, "ConfidenceInterval"]@lm[{"MeanPredictions", "SinglePredictions", "ParameterEstimates"}, ConfidenceLevel -> .99]Related Guides
History
Text
Wolfram Research (2008), ConfidenceLevel, Wolfram Language function, https://reference.wolfram.com/language/ref/ConfidenceLevel.html.
CMS
Wolfram Language. 2008. "ConfidenceLevel." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ConfidenceLevel.html.
APA
Wolfram Language. (2008). ConfidenceLevel. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ConfidenceLevel.html
BibTeX
@misc{reference.wolfram_2026_confidencelevel, author="Wolfram Research", title="{ConfidenceLevel}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/ConfidenceLevel.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_confidencelevel, organization={Wolfram Research}, title={ConfidenceLevel}, year={2008}, url={https://reference.wolfram.com/language/ref/ConfidenceLevel.html}, note=[Accessed: 12-June-2026]}