knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Dataset in the package

library(bis557)
library(DT)
datatable(lm_patho)

Above is the lm_patho dataset in package bis557. This dataset is used to check the validity of linear_model() function in a tougher case.

Functions in the package

We have 2 functions in this package: linear_model() which is used to fit the linear model by QR decomposition, and my_gd(), which is used to implement the gradient descent to find the fitted coefficients.

Below we use the dataset iris as example:

linear_model(Sepal.Length ~ ., iris)

Also we can apply a tough data set lm_patho to this function:

linear_model(y ~ ., lm_patho)

We can see that the output coefficients is very close to the output of lm() function.



siqiangsu/bis557 documentation built on Dec. 21, 2020, 2:15 a.m.