ols.rgr: Linear Regression using Ordinary Least Squares

Description Usage Arguments Details Value Examples

View source: R/ols.rgr.R

Description

Fit a linear regression model using Ordinary Least Squares.

Usage

1
ols.rgr(dataset)

Arguments

dataset

a p x m data matrix, where the final column is a continuous outcome variable. datashape may be applied to data so that the dataset is in the correct format for this function (see manual)

Details

This function may be called directly. For regression with an intercept included, the first column in the dataset must be a column of 1s.

Value

the function returns a column-vector containing the linear regression coefficients.

Examples

1
2
3
4
5
6
## Linear regression using a subset of the mtcars data (outcome is "wt")
data(mtcars)
mtc.df <- mtcars[, c(6, 1, 4)]
mtc.shaped <- datashape(dataset = mtc.df, y = 1)
ols.rgr(mtc.shaped)
ols.rgr(cbind(1,mtc.shaped))

apricom documentation built on May 29, 2017, 7:36 p.m.

Search within the apricom package
Search all R packages, documentation and source code