knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(bis557)
The R package {bis557} was built to store all the functions and data used for this class, which focuses on creating statistical models and algorithms.
linear_model() - create a linear model, similar to R's lm() functiongrad_descent() - the gradient descent algorithm used in MLBelow is an example dataset, lm_patho from the {bis557} package, that can be
used for linear regression.
library(bis557) data(lm_patho) head(lm_patho)
This is a basic example which shows you to create a linear model, for example, doing regression analysis.
$$ y \sim \beta_1 x_1 + \beta_2 x_2 $$
library(bis557) data(lm_patho) fit_linear_model <- linear_model(y ~., lm_patho)
This is a basic example which shows you how to solve a common problem: Use an optimization algorithm, such as gradient descent, to find the coefficients of simple linear regression.
library(bis557) data(lm_patho) gd_patho <- grad_descent(X = lm_patho[,-1], y = lm_patho[,1], b_0 = rep(1e-16, ncol(lm_patho)), learn_rate = 1.3e-16, max_iter = 1e5) gd_patho
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.