Author: user
Mean as a Projection
This tutorial explains how mean can be viewed as an orthogonal projection onto a subspace defined by the span of an all 1’s vector (i.e., basis vector). Suppose that \( \vec{y} \in \mathbb{R}^n \) and \( L \subset \mathbb{R}^n\) is...
Read Full Article →
Orthogonal Projection
This tutorial explains what an orthogonal projection is in linear algebra. Further, it provides proof that the difference between a vector and a subspace is orthogonal to that subspace. Let’s define two vectors, \(\vec{X} \) and \(\vec{Y} \), and we...
Read Full Article →
Difference between Space and Subspace
This tutorial explains the difference between space and subspace. What is space? The most simple example of space is the two-dimensional space, \( \mathbb{R}^2 \). You can visualize it as the xy-coordinate plane. \( \mathbb{R}^2 \) is a vector space...
Read Full Article →
Linear Subspace
A linear subspace or vector subspace is a vector space that is a subset of some larger vector space. To be considered a linear subspace, a vector set needs to meet the following 3 requirements. For instance, if we say...
Read Full Article →
Vector and Arrow in Space
This tutorial provides examples to explain vectors and arrows in space (vector visualization). It includes 2 and 3-dimension vectors as well as vector addition and subtraction. Example 1: 2 dimension vectors \( \vec{V_1} =(3, 2 ) = \left[\begin{array}{ccc}3\\2 \end{array}\right]\) Note...
Read Full Article →
Orthonormal Vectors: Definitions and Examples
Two Orthogonal Vectors Definition: Two vectors are orthogonal if they are perpendicular to each other. That is, the dot product of the two vectors is zero. The following is an example of two orthonormal vectors. \( \vec{V_1} =\left[\begin{array}{ccc}1\\0\\-1\end{array}\right]\), \( \vec{V_2}...
Read Full Article →
Interaction in Linear Regression
This tutorial focuses on interaction between a categorial variable and a continuous variable in linear regression. Note that, in this tutorial, we limit the the categorical variable to be 2 levels. (For a categrocial variable with 3 levels, please refer...
Read Full Article →
Dummy and Contrast Codings in Linear Regression
This tutorial explains the differences between dummy coding and contrast coding in linear regression using R code examples. It is worth pointing out that, this tutorial focuses on the categorical independent variable has 3 levels. Short Note Note that, in...
Read Full Article →
Changing Reference Level in Dummy Coding in R
You can change the reference level in dummy coding in R by using the following R code. contr.treatment(total_levels, base = Number_reference_level) Step 1: Prepare Data The following R code generates a sample data. X Y 1 1 -0.56047565 2 2...
Read Full Article →
Dummy and Contrast Codings in R
“Dummy” or “treatment” coding is to create dichotomous variables where each level of the categorical variable is contrasted to a specified reference level. Basic Syntax of Dummy and Contrast Coding 1. Dummy Coding The following is the syntax to do dummy...
Read Full Article →