Learn R Programming

bigstep (version 0.7.4)

fitLinear: Linear regression

Description

Fit the linear regression model and calculate the log-likelihood.

Usage

fitLinear(X, y)

Arguments

X

a numeric matrix.

y

a numeric vector.

Value

A number, the log-likelihood.

Examples

Run this code
# NOT RUN {
set.seed(1)
n <- 100
M <- 10
X <- matrix(rnorm(M*n), ncol=M)
y <- X[, 2] - X[, 3] + X[, 6] - X[, 10] + rnorm(n)
fitLinear(X, y)
# }

Run the code above in your browser using DataLab