Learn R Programming

RVAideMemoire (version 0.9-11)

reg.slpcomp: Comparison of several simple linear regression slopes

Description

Test for equality of slopes of several simple regression lines. The function returns the confidence interval of each slope and perfoms pairwise comparisons.

Usage

reg.slpcomp(formula, data=NULL, conf.level = 0.95, p.method = "fdr")

Arguments

formula
a formula of the form y ~ x | f, where y and x give the dependent and independent variable, respectively, and f is a factor giving levels to be compared.
data
an optional data frame containing the variables in the formula formula. By default the variables are taken from environment(formula).
conf.level
confidence level.
p.method
method for p-values correction. See help of the p.adjust() function.

Value

  • data.namea character string giving the name(s) of the data.
  • conf.levelconfidence level.
  • coeffsslope of each regression line.
  • coeffs.tabslope and confidence interval of each regression line.
  • p.adjust.methodmethod for p-value correction.
  • multcomptable of results of pairwise comparisons.

See Also

lm

Examples

Run this code
covariable <- rep(1:30,3)
variable <- c(seq(1,10,9/29)+rnorm(30,0,3),seq(1,30,1)+rnorm(30,0,3),seq(-1,-80,-79/29)+rnorm(30,0,3))
fact <- gl(3,30,labels=LETTERS[1:3])
reg.slpcomp(variable~covariable|fact)

Run the code above in your browser using DataLab