OLS vs. MLE in Linear Regression

This tutorial is to compare OLS (Ordinary Least Square) and Maximum Likelihood Estimate (MLE) in linear regression. We are going to use simple linear regression as examples here. Most of the conclusions can be directly extended into general linear regressions. OLS in Linear Regression Coefficients The principle of ordinary least squares is to minimize the … Read more

Maximum Likelihood Estimation for Linear Regression in R

To use maximum likelihood estimation (MLE) in linear regression in R, you can use either optim() or mle() function. The following provides detailed R code examples. Data and Model Suppose we want to test the effect of teaching method (new vs. old) on students’ test scores. The following is the data. In the R code, 0 represents ‘old’ … Read more

List of Master’s in Data Science in Ivy League Universities

This post provides a list of Ivy League universities offering Master’s in Data Science. In short, except for Princeton and Dartmouth, most schools offers Master’s in Data Science. University Names Master’s in Data Science Webpage Columbia Yes MS Data Science webpage Cornell Yes MS Operations Research and Information Engineering Harvard Yes Program info webpage UPenn … Read more

Maximum Likelihood Estimation (MLE) in Linear Regression

This tutorial is going to explain what Maximum Likelihood Estimation (MLE) is and how Maximum Likelihood Estimation (MLE) can be used in linear regression. Basics of Maximum Likelihood Estimation Before discussing about linear regression, we need to have a basic idea of MLE. In particular, assume that \( y_i \) are all independently and identically … Read more

Chi-square Independence Test in SPSS

The chi-square independence test is a statistical test used to determine if there is a significant association between two categorical variables. It assesses whether the observed frequencies of the variables in a contingency table differ significantly from the expected frequencies under the assumption of independence. SPSS Data for Chi-square Independence Test This hypothetical data set … Read more

McNemar’s Test in SPSS

This tutorial explains the definition of McNemar’s test, the writing of the null and alternative hypotheses for McNemar’s test, the steps of conducting it in SPSS, and how to interpret the output of McNemar’s test as well as how to report the results. When to Use McNemar’s Test? The McNemar test is used to analyze … Read more

Create OpenAI Style Illustrations in Python

This tutorial shows how to create OpenAI website style illustrations using Python Turtle graphics. The following includes two examples. Example 1: Parallel Lines The following is the first example of drawing an OpenAI-style figure using Python Turtle. If you run the code, you will get the following figure, which includes some parallel lines with different … Read more

Meaning of #### in Excel

In Excel, the term “####” typically represents a series of number or pound signs (#####) that appear in a cell when the content is too long to be displayed fully within the available column width. It is often referred to as the “overflow error” or “cell truncation.” The following reproduces this term, namely #### in … Read more

How to Create Contingency Table in Excel

You can create a contingency table in Excel using the Pivot Table. This tutorial includes steps showing how to create a contingency table for count data. Data and Resarch Question for Contingency Table The following is the sample data used in Excel. It is a hypothetical data record showing a group of 20 participants’ recent … Read more

How to Export DataFrame to CSV in R

You can use the write.csv() from base R or write_csv() from “readr” package to export a dataframe to CSV in R. write.csv() write.csv(df_1,”csv_file_name.csv”, row.names=FALSE) write_csv() write_csv(df_2,”csv_file_name.csv”) Example 1: Use write.csv() The following is the output of the dataframe df_1. > print(df_1) Letters Numbers 1 A 1 2 B 1 3 C 0 4 D 1 … Read more