The goal of {bis557} is to show the work that Brian did in the BIS 557 Fall 2020 class. These include packages, functions, and data for common statistical algorithms.
The final vignette has been uploaded already, on 12/14/2020. The final dataset is on 2020 Boston Residential Property Assessment.
You can install the released version of {bis557} from Github with:
library(devtools)
devtools::install_github("brian-d1018/bis557")
Below 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)
print(fit_linear_model <- linear_model(y ~., lm_patho))
Suppose that if the model matrix is ill-conditioned, then we can use QR
decomposition for $X=QR$.
The trick is to use the function qr.coef()
.
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)
print(gd_patho)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.