Linear Regression from Scratch

A tutorial explaining how to perform simple linear regression from scratch using linear algebra, calculus, and of course R.  Regression analysis has the objective to model, in a mathematical way, the behavior of a respond variable as a function of one or more independent variables (factors). As a practical example, think about a process of alcohol production using the microscopic fungus Saccharomyces cerevisiae (yeast). You know that alcohol yield is a linear function of the concentration of sucrose for some interval of concentrations, you are also interested on making nice predictions of alcohol yield for a given sucrose concentration....

July 29, 2021

Basic Linear Algebra with R

Basic linear algebra operations with R.  1 Introduction Linear algebra is the study of vectors and linear functions. On this post I’m going to show you how to perform some basic linear algebra operations with R. 2 Vector operations 2.1 Define vectors You can define vectors simply as follows: # Define two vectors x <- c(30, 20, 40, 10) y <- c(20, 15, 18, 40) 2.2 Sum You can add vectors with the same length:...

March 28, 2021