knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
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.
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.