Calculate Sum of Squared Residuals (SSR) in R

Introduction Sum of Squared Residuals SSR is also known as residual sum of squares (RSS) or sum of squared errors (SSE). The following is the formula. SSR can be used compare our estimated values and observed values for regression models. R can be used to calculate SSR, and the following is the core R syntax. … Read more

Logistic Regression: Definition and Example

1. What is Logistic Regression? Logistic regression is a model testing the relationship between Y (which is as a binary variable) and X (X can be more than one). logistic regression is also called logit regression. 2. Difference between logistic regression and linear regression We often encounter situations where the result is binary, such as yes … Read more

What is Linear Regression Model? Definition and Example

1. Definition of Linear Regression Model Multiple linear regression is a linear model accessing the relationship between a dependent variable (DV, or Y) and multiple intendent variables (IV, or X). For instance, you might want to test how consumer purchase intention can be impacted by price as well as by household income. In this case, … Read more

How to Write Null and Alternative Hypothesis for Two-Way ANOVA

This tutorial shows how to write null and alternative hypothesis for two-way ANOVA. It is an extension of my other tutorial on this same topic. 1. Introduction A two-way ANOVA is used to test whether the means from the two or more categorieal variables are significantly different from one another. For instance, below, there are two categorical variables, … Read more

rep() Function in R (4 Examples)

rep() is a built-in R function that replicates the values in the provided vector. This tutorial shows how to use rep() function in R with 4 examples. Example 1 The following code is to repeat the number 4 twice. Output: [1] 4 4 Example 2 Output: [1] 1 2 3 1 2 3 1 2 3 … Read more

Categories R

Paired t-test in R (2 Examples)

Method 1 for paired t-test is for a situation group 1 and group 2 are two separate vectors, whereas Method 2 is for two groups of data in the same column. Method 1: t.test(group_1, group_2, paired = TRUE) Method 2: t.test(y~group, data=my_data, paired = TRUE) Data and Hypothesis Suppose we would like to test whether … Read more

Categories R

Two sample t-test: Definition, formula, and Examples

Two sample t-test is also called independent sample t-test or unpaired sample t-test. This tutorial explains what two sample t-test is, its formula, and examples of two sample t-test. Definition and Example Two sample t-test is used to test whether means from two different groups of people or objects are significantly different. The name of … Read more

Correlation: Definition, Formula, and Examples

What is Correlation? Correlation is a statistical measure of the relationship between two variables, X and Y. For instance, you can measure to what extent temperature (X) is related to the production of ice cream (Y). You probably would expect that higher temperatures correspond with higher production of ice cream. On the plot shown below, … Read more