computeResidualLm {rotRPackage}R Documentation

Computes a linear model's residuals

Description

This ROT function, called from a LinearModelFactory, is given two samples and a parameter vector. It is used to predict the values corresponding to the explanatory variables through the linear model, then compare them with the second sample. It returns the difference between both samples.

Usage

computeResidualLm(x, beta, y)

Arguments

x A m-by-n matrix containing the explanatory variables.
beta A n-by-1 vector containing the linear model parameters.
y A n-by-1 vector containing the response variables.

Value

A m-by-1 vector is returned, containing the difference between predicted and response values.

Author(s)

Pierre-Matthieu Pair, Softia for EDF.

Examples

set.seed(1)
x <- matrix(runif(40), 10, 4)
r <- matrix(c(1,2,3,4), 4, 1)
y <- x %*% r 
e <- matrix(rnorm(10, 0, 0.05), 10, 1)
LM <- computeLinearModel(x, y + e)
computeResidualLm(x, LM$parameterEstimate, y)

[Package rotRPackage version 1.4.3 Index]