powered by
Given a vector of data and a design matrix, the least squares estimates for a linear model is computed.
leastsquares(data, design)
A data vector.
A design matrix. The number of rows must be equal to the length of the data vector.
A vector of values of length equal to the number of columns in the design matrix.
The fitted values represent the expected values all but the last variables in the posterior for the linear model.
linearmodel, fittedvalues, linearpredict
linearmodel
fittedvalues
linearpredict
# NOT RUN { xdata <- simulate(uniformdistribution(), 14) ydata <- xdata + 4 + simulate(normal(), 14)*0.1 plot(xdata,ydata) design <- cbind(1, xdata) leastsquares(ydata, design) # }
Run the code above in your browser using DataLab