grad.quad: Gradient of the squared error.

Description Usage Arguments Value Examples

Description

Computes the gradient of the sum of squared error:

f(x) = 1/(2n) ∑_{i=1}^n ( x'*A_i - b_i)^2

.

Usage

1
grad.quad(x, opts)

Arguments

x

A p-dimensional vector where the gradient is computed.

opts

List of parameters, which must include:

  • A, a n*p design matrix, where each row is a sample and each column is a variable

  • b, a n-dimensional response vector.

Value

The gradient of the function f(x) = 1/(2n) || Ax - b ||^2, which is A'*(Ax - b)/n.

Examples

1
grad.quad(c(1,3,-2), list(A=diag(3), b=rep(1,3)))

jpvert/apg documentation built on May 19, 2019, 11:51 p.m.