Posts

Showing posts from July, 2020

Non-Linear Programming: A Multiple Data Set Approach

Image
Introduction We have all been there. You are at the end of the school semester, and the only thing left to do is take that dreaded final exam. Like me, you would calculate the minimum exam score needed to receive a particular grade. For example, you might be able to score a 70% on your History exam and still get a B in the class. This is valuable information since you might decide to spend more time studying for other exams if you think a 70% is easily achievable. In this article, we will solve this very straightforward optimization problem programmatically using R’s ROI package . In the first example, we will find the minimum grade needed on the final exam to receive a B in our History class . In the second example, we will find the minimum final exam grade needed to receive a B (80%) for all four classes: History, Science, Math, & English . This article aims to show you how to solve similarly structured optimization problems with various data sets all in one function. Linear v N...

Bootstrapping Confidence Intervals

Image
  Introduction Bootstrapping is a simple yet powerful method that helps you estimate confidence intervals that can be used to enhance your data analysis. Although there are many other ways to calculate confidence intervals for data sets, this article focuses solely on bootstrapping methods. According to Wikipedia, “bootstrapping is any test or metric that uses random sampling with replacement, and falls under the broader class of resampling methods. Bootstrapping assigns measures of accuracy (bias, variance, confidence intervals , prediction error, etc.) to sample estimates. This technique allows estimation of the sampling distribution of almost any statistic using random sampling methods.” This article will show you two ways to bootstrap in R. The first example will show you how to bootstrap the hard way . This will allow any viewers the opportunity to better understand how bootstrapping methods are built from scratch. The second example will show and you how to bootstrap the easy...

Exploring Expected Values

Image
Introduction Expected values can be a little tricky to understand the first time around. Using some simple and more advanced examples, this article will help you understand the mystery behind Expected  Values. We will specifically answer the following questions with the help of R: Q1: How much do I gain - or lose - on average if I repeatedly play a given gambling game? Q2: How much can I expect to gain - or lose - by making a particular bet? Q3: What is the likelihood of owing your friend money after 3 bets given 4:1 favorable odds? Q4: What is the minimum number of bets needed to have a ~98% chance of a net win given 4:1 odds? Questions 1 and 2 source: StatLect Gratitude & Motivation Inspiration and the early examples used for this post come directly from Josh Starmer’s StatQuest video on Expected Values . I really enjoy Josh’s delivery and highly recommend his videos. Expected Value Defined Expected Values and Probability are two essential foundations of statistics. ...