Generate Vectors only Contains 0 And 1 in R

You can generate a vector only containing 0 and 1 in R using sample() and rbinom() functions. sample: sample(c(0, 1), size = 10, replace = TRUE) rbinom: rbinom(10, size = 1, prob = 0.5) In both sample() and rbinom(): Example 1 The following is the output. > print(vector_1) [1] 0 0 1 1 1 1 … Read more

Calculate p-value in Linear Regression

This tutorial shows how you can calculate p-value for linear regression. It includes formulas and data examples in Python. Formulas for p-value in Linear Regression We can estimate the regression coefficient B using the following formula. Where, Such calculation only generates regression coefficients but no p-values. To calculate the p-value, you need to calculate the … Read more

Experimental Design in Advertising Research

This tutorial explains the types of advertising experiment design and the detailed steps of conducting experimental research for advertising campaigns. Types of Advertising Experiments The first one is a simple version of the experiment design, which includes a control condition (no ad) and a treatment condition (with ad viewing). In some situations, you might want … Read more

Linear Mixed Models in SPSS

This tutorial includes the explanation of what a linear mixed model is, how to structure its statistical model, data example, as well as steps for linear mixed models in SPSS. Definition of Linear Mixed Models Linear mixed models (LMMs) are statistical models used to analyze data that have both fixed and random effects. They are … Read more

Data Type and Data Summary

This tutorial explains what data type (including numerical data and categorical data) is and how to summarize different types of data. Data Type Broadly speaking, data can be categorized into two types: categorical and numerical. Categorical data refers to variables that have a finite number of categories or groups. Examples of categorical data include gender … Read more

MS in Business Analytics in Ivy League Universities

Columbia and Cornell are two schools in the Ivy League directly offering MS in Business Analytics (MSBA). Further, UPenn offers a dual program within its MBA program with MS in Data Science. Other than these 3 universities, all other Ive League universities do not offer MSBA, even though Harvard offers a certificate (NOT degree) in … Read more

How Dummy and Contrast Codings Impact P-values in SPSS

This tutorial discusses how dummy and contrast codings impact p-values in SPSS for linear regressions. Single Categorical Variable We can start with only one Y (numerical data, or continuous data) and one X (categorical data). We keep it simple to only have 4 observations. The cell means are (3+4)/2=3.5 vs. (5+6)/2=5.5, and the difference is … Read more

Linear Regression and Orthogonal Projection

This tutorial explains why and how linear regression can be viewed as an orthogonal projection on 2 and 3-dimensional spaces. Projection with 2 Dimensions Suppose that both X0 and Y have 2 dimensions (e.g., 2 observations from 2 participants). It is worth pointing out that, when talking about dimensions here, we refer to the number … Read more

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 the span defined by the space of vector \( \vec{x} \), namely, \( \vec{x}=\left[\begin{array}{ccc}1\\1\\ …\\ … Read more

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 want to find the shortest distance between \(\vec{Y} \) and the subspace defined by the … Read more