Learn R Programming

gputools (version 1.1)

gpuLsfit: Least squares fit using GPU--enabled QR decomposition

Description

The least squares estimate of $b$ in the model $$\bold{Y} = \bold{X \beta} + \bold{\epsilon}$$ is found.

Most of this documentation is copied from R's documentation for lsfit. The function gpuLsfit performs a least--squares fit using a GPU enabled QR decomposition.

Note: The QR decomposition employed by gpuLm is optimized for speed and uses minimal pivoting. If more precise pivoting is desired, then either the function gpuQR or, better still, svd should be used.

Usage

gpuLsfit(x, y, wt = NULL, intercept = TRUE, useSingle = TRUE, tolerance=gpuLm.defaultTol(useSingle), yname = NULL)

Arguments

x
a matrix whose rows correspond to cases and whose columns correspond to variables.
y
the responses, possibly a matrix if you want to fit multiple left hand sides.
wt
an optional vector of weights for performing weighted least squares.
intercept
whether or not an intercept term should be used.
useSingle
whether to use single precision arithmetic on the gpu. Only the 'TRUE' option is implemented so far.
tolerance
the tolerance to be used in the matrix decomposition. This defaults to 1e-04 for single--precision GPU computation.
yname
names to be used for the response variables.

Value

A list with the following named components: A list with the following named components:

Details

If weights are specified then a weighted least squares is performed with the weight given to the jth case specified by the jth entry in wt.

If any observation has a missing value in any field, that observation is removed before the analysis is carried out. This can be quite inefficient if there is a lot of missing data.

The implementation is via a modification of the LINPACK subroutines which allow for multiple left-hand sides.

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

See Also

lsfit, lm, ls.print, ls.diag

Examples

Run this code

##-- Using the same data as the lm(.) example:
lsD9 <- gpuLsfit(x = unclass(gl(2,10)), y = weight)
ls.print(lsD9)

Run the code above in your browser using DataLab