Learn R Programming

confintr (version 1.0.0)

ci_rsquared: CI for the Population R-Squared

Description

This function calculates parametric CIs for the population R-squared. It is based on CIs for the non-centrality parameter Delta of the F distribution, found by test inversion. Delta values are mapped to R-squared by R-squared = Delta / (Delta + df1 + df2 + 1), where df1 and df2 are the degrees of freedom (df) of the F test statistic. A positive lower (1-alpha)*100%-confidence limit for the R-squared goes hand-in-hand with a significant F test at level alpha.

Usage

ci_rsquared(x, df1 = NULL, df2 = NULL, probs = c(0.025, 0.975))

Value

An object of class "cint" containing these components:

  • parameter: Parameter specification.

  • interval: CI for the parameter.

  • estimate: Parameter estimate.

  • probs: Lower and upper probabilities.

  • type: Type of interval.

  • info: Additional description.

Arguments

x

The result of stats::lm() or the F test statistic.

df1

The numerator df. Only used if x is a test statistic.

df2

The denominator df. Only used if x is a test statistic.

probs

Lower and upper probabilities, by default c(0.025, 0.975).

Details

According to ?stats::pf, the results might be unreliable for very large F values. Note that we do not provide bootstrap CIs here to keep the input interface simple.

References

Smithson, M. (2003). Confidence intervals. Series: Quantitative Applications in the Social Sciences. New York, NY: Sage Publications.

See Also

ci_f_ncp.

Examples

Run this code
fit <- stats::lm(Sepal.Length ~ ., data = iris)
summary(fit)$r.squared
ci_rsquared(fit)
ci_rsquared(fit, probs = c(0.05, 1))

Run the code above in your browser using DataLab