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 that contains all possible two-dimensional vectors \( \vec{v} = (x, y) \). Similarly, \( \mathbb{R}^3 … Read more

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 that \( V \) is a subset of \( \mathbb{R}^n \) and in order to … Read more

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 that, \( (3, 2 ) \) and \( \left[\begin{array} {ccc} 3\\ 2 \end{array} \right]\) are … Read more

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} =\left[\begin{array}{ccc}1\\3\\1\end{array}\right] \) That is, \( (1 \times 1) + (0 \times 3) +(-1 \times 1) … Read more

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 to my another tutotrial on interaction and coding in linear regression .) Coding Note In … Read more

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 R, the default reference group in dummy coding uses the first item in an alphabetical … Read more

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 -0.23017749 3 3 1.55870831 4 1 0.07050839 5 2 0.12928774 6 3 1.71506499 7 1 … Read more

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 coding in R. contr.treatment( number_of_level_of_X ) 2 3 1 0 0 2 1 0 3 … Read more

Comparisons of t-distribution and Normal distribution

This tutorial compares t-distribution and normal distribution by explaining the similarities and connections between t-distribution and normal distribution. Similarities between t-distribution and normal distribution There are a few similarities between t-distribution and normal distribution. The following figure shows the t-distribution density function curve and the standard normal curve. As we can see, as the sample … Read more

Quartile: Definition and Example

Definition of Quartile A quartile is a statistic describing how a set of data points are divided into 4 groups. Quartiles split a set of data by using 3 points: the lower quartile (Q1), the median (Q2), and the upper quartile (Q3). Together with the minimum and maximum values, 3 quartiles split the data set … Read more