Learn R Programming

RVAideMemoire (version 0.9-35)

least.rect: Least rectangles linear regression

Description

Fit a least rectangle linear regression, possibly for each level of a factor.

Usage

least.rect(formula, data, conf.level = 0.95, theo = 1)

Arguments

formula
a formula of the form y ~ x, where y and x give the y and x variable, respectively. The formula can also be y ~ x | f to fit a (separate) regression for each level of the factor f.
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.
theo
theoretical value of the slope. If several regression are fitted, the same value is used for all comparisons of slope vs. theoretical value.

Value

  • coefficientsregression parameters.
  • residualsresiduals.
  • fitted.valuesfitted values.
  • callthe matched call.
  • modelthe model frame used.
  • conf.levelconfidence level.
  • conf.intconfidence interval of regression parameters.
  • theotheoretical value of the slope.
  • compdata frame of results for equality of the slope(s) to the theoretical value.
  • corrdata frame of results for significativity of the correlation coefficient(s).
  • multiplelogical, TRUE if several regressions are fitted.

Examples

Run this code
x <- 1:30+rnorm(30,0,3)
y <- 1:30+rnorm(30,0,3)
regression1 <- least.rect(y~x)
summary(regression1)

x2 <- c(1:30,1:30)
y2 <- c(1:30+rnorm(30,0,3),seq(10,22,12/29)+rnorm(30,0,3))
fact <- gl(2,30,labels=LETTERS[1:2])
regression2 <- least.rect(y2~x2|fact)
summary(regression2)

Run the code above in your browser using DataLab