ci.slope: Confidence interval for a slope in a simple linear model

View source: R/statpsych2.R

ci.slopeR Documentation

Confidence interval for a slope in a simple linear model

Description

Computes a confidence interval for a population slope coefficient in a simple linear model using the sample correlation, sample standard deviation of the y scores (response variable), sample standard deviation of the x scores (predictor variable), and sample size as input.

For more details, see Section 1.11 of Bonett (2021, Volume 2)

Usage

ci.slope(alpha, cor, sdy, sdx, n)

Arguments

alpha

alpha level for 1-alpha confidence

cor

estimated Pearson correlation

sdy

estimated standard deviation of response variable

sdx

estimated standard deviation of predictor variable

n

sample size

Value

Returns a 1-row matrix. The columns are:

  • Estimate - estimated slope

  • SE - standard error

  • t - t test statistic

  • df - degrees of freedom

  • p - two-sided p-value

  • LL - lower limit of the confidence interval

  • UL - upper limit of the confidence interval

References

\insertRef

Bonett2021statpsych

Examples

ci.slope(.05, .362, 25.1, 6.25, 85)

# Should return:
#  Estimate        SE      t df       p        LL       UL
#  1.453792 0.4109165 3.5379 83 0.00066 0.6364957 2.271088
 


statpsych documentation built on Jan. 13, 2026, 1:07 a.m.