Posts by Learning Machines
Author: Learning Machines
Create Bart Simpson Blackboard Memes with R
Feed: R-bloggers. Author: Learning Machines. Everybody knows the Simpsons, everybody loves the Simpsons and everybody can laugh about Bart Simpson writing funny lines on the blackboard! If you want to create your own Bart Simpson Blackboard Meme Generator with R read on! Conveniently enough there is a package for creating memes already (who would have thought otherwise, because there is a package for everything!), the meme package by my colleague Professor Guangchuang Yu from the University of Hong Kong. After installing it from CRAN we load it, assuming that you work on a Windows machine load the Comic Sans font ... Read More
Financial Engineering: Static Replication of any Payoff Function
Feed: R-bloggers. Author: Learning Machines. In the area of option strategy trading, it has always been a dream of mine to have a universal tool that is able to replicate any payoff function statically by combining plain vanilla products like calls, puts, and zerobonds. Many years ago there was such a tool online but it has long gone since and the domain is inactive. So, based on the old project paper from that website I decided to program it in R and make it available for free here! The project paper the algorithm is based on and which is translated ... Read More
“You Are Here”: Understanding How GPS Works
Feed: R-bloggers. Author: Learning Machines. Last week, I showed you a method of how to find the fastest path from A to B: Finding the shortest Path with Dijkstra’s Agorithm. To make use of that, we need a method to determine our position at any point in time. For that matter, many devices use the so-called Global Positioning System (GPS). If you want to understand how it works and do some simple calculations in R, read on! Nowadays most of us have several GPS devices, in their cars, their smartphones, and their smartwatches. Those are receivers of signals coming from ... Read More
Finding the Shortest Path with Dijkstra’s Algorithm
Feed: R-bloggers. Author: Learning Machines. I have to make a confession: when it comes to my sense of orientation I am a total failure… sometimes it feels like GPS and Google maps were actually invented for me! Well, nowadays anybody uses those practical little helpers. But how do they actually manage to find the shortest path from A to B? If you want to understand the father of all routing algorithms, Dijkstra’s algorithm, and want to know how to program it in R read on! This post is partly based on this essay Python Patterns – Implementing Graphs, the example ... Read More
3.84 or: How to Detect BS (Fast)
Feed: R-bloggers. Author: Learning Machines. In From Coin Tosses to p-Hacking: Make Statistics Significant Again! I explained the general principles behind statistical testing, here I will give you a simple method that you could use for quick calculations to check whether something fishy is going on (i.e. a fast statistical BS detector), so read on! We are living in a complex world and it is often not easy to distinguish “alternative facts” from the truth. In this post, I am giving you the statistical analog of a Swiss army knife that you could use with minimal effort to sort out ... Read More
Network Analysis: Who is the Most Important Influencer?
Feed: R-bloggers. Author: Learning Machines. Networks are everywhere: traffic infrastructure and the internet come to mind, but networks are also in nature: food chains, protein-interaction networks, genetic interaction networks and of course neural networks which are being modelled by Artificial Neural Networks.In this post, we will create a small network (also called graph mathematically) and ask some question about which is the “most important” node (also called vertex, pl. vertices). If you want to understand important concepts of network centrality and how to calculate those in R, read on!This post is based on a LinkedIn post by renowned data scientist ... Read More
Local Differential Privacy: Getting Honest Answers on Embarrassing Questions
Feed: R-bloggers. Author: Learning Machines. Do you cheat on your partner? Do you take drugs? Are you gay? Are you an atheist? Did you have an abortion? Will you vote for the right-wing candidate? Not all people feel comfortable answering those kinds of questions in every situation honestly.So, is there a method to find the respective proportion of people without putting them on the spot? Actually, there is! If you want to learn about randomized response (and how to create flowcharts in R along the way) read on!The question is how can you get a truthful result overall without being ... Read More
Doing Maths Symbolically: R as a Computer Algebra System (CAS)
Feed: R-bloggers. Author: Learning Machines. When I first saw the Computer Algebra System Mathematica in the nineties I was instantly fascinated by it: you could not just calculate things with it but solve equations, simplify, differentiate and integrate expressions and even solve simple differential equations… not just numerically but symbolically! It helped me a lot during my studies at the university back then. Normally you cannot do this kind of stuff with R but fear not, there is, of course, a package for that!There are many so-called Computer Algebra Systems (CAS) out there, commercial but also open-source. One very mature ... Read More
Time Series Analysis: Forecasting Sales Data with Autoregressive (AR) Models
Feed: R-bloggers. Author: Learning Machines.
Forecasting the future has always been one of man’s biggest desires and many approaches have been tried over the centuries. In this post we will look at a simple statistical method for time series analysis, called AR for Autoregressive Model. We will use this method to predict future sales data and will rebuild it to get a deeper understanding of how this method works, so read on! Let us dive directly into the matter and build an AR model out of the box. We will use the inbuilt BJsales dataset which contains 150 observations ... Read More
COVID-19: False Positive Alarm
Feed: R-bloggers. Author: Learning Machines.
In this post, we are going to replicate an analysis from the current issue of Scientific American about a common mathematical pitfall of Coronavirus antibody tests with R. Many people think that when they get a positive result of such a test they are immune to the virus with high probability. If you want to find out why nothing could be further from the truth, read on! The following article provides a good intuition of why the accuracy of screening tests is highly dependent on the infection rate: Scientific American: Coronavirus Antibody Tests Have ... Read More
Recent Comments