ciperm.linreg: Confidence interval for the slope parameter in linear...

View source: R/linreg.R

ciperm.linregR Documentation

Confidence interval for the slope parameter in linear regression

Description

Calculates the permutation-test based confidence interval for β_1 in the linear regression model

y = β_0 + β_1 x + ε

. Works in both for univariate and multivariate cases (but x must be univariate).

Usage

ciperm.linreg(x, y, bounds, ...)

Arguments

x

Values of the independent variable. A numeric vector of length N.

y

Values of the dependent variable. A numeric vector of length N or a matrix of dim N x K.

bounds

Bounds forwarded to uniroot in the search for l and u values.

...

Additional arguments to ciperm or ciperm.multi

Value

Vector or array of lower and upper ends of the confidence interval

See Also

ciperm, ciperm.multi

Examples

x <- runif(20, -1, 1)
y <- 3 + 0.8*x + rt(20, df = 4)

ciperm.linreg(x, y, bounds = c(-5, 6))


## Multivariate example (requires package \code{mvtnorm})
library(mvtnorm)
x <- runif(20, -1, 1)
sigma <- matrix(0.80, 4, 4)
diag(sigma) <- 1

y <- 3 + 0.8*x + rmvnorm(20, mean = rep(0,4), sigma = sigma)

ciperm.linreg(x, y, bounds = c(-7, 8))


naolsen/ciperm documentation built on July 1, 2022, 3:41 p.m.