leastsquares: Find the Least Squares Solution in a Linear Model

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/lestat.R

Description

Given a vector of data and a design matrix, the least squares estimates for a linear model is computed.

Usage

1
leastsquares(data, design)

Arguments

data

A data vector.

design

A design matrix. The number of rows must be equal to the length of the data vector.

Details

The fitted values represent the expected values all but the last variables in the posterior for the linear model.

Value

A vector of values of length equal to the number of columns in the design matrix.

Author(s)

Petter Mostad <[email protected]>

See Also

linearmodel, fittedvalues, linearpredict

Examples

1
2
3
4
5
xdata <- simulate(uniformdistribution(), 14)
ydata <- xdata + 4 + simulate(normal(), 14)*0.1
plot(xdata,ydata)
design <- cbind(1, xdata)
leastsquares(ydata, design)

lestat documentation built on May 29, 2017, 8:24 p.m.