Multiple regression: Difference between revisions

Content added Content deleted
m (→‎{{header|R}}: use QR instead of the normal equations)
Line 1,442: Line 1,442:
than the method above, is to solve the linear system directly
than the method above, is to solve the linear system directly
and use the crossprod function:
and use the crossprod function:
<lang R>solve( crossprod(X), crossprod(X, Y))</lang>
<lang R>solve(crossprod(X), crossprod(X, Y))</lang>

A numerically more stable way is to use the QR decomposition of the design matrix:

<lang R>qr.coef(qr(X), y)</lang>


=={{header|Racket}}==
=={{header|Racket}}==