Publications by Mic

Approximating the value of pi with a Monte Carlo approach

17.07.2014

Sometimes a value cannot be found so easily, this is the case for probabilities for example. When it comes to find the chances, say of a football team winning a certain match, you cannot use traditional probability approach, which is: or, I should say, you could use it, but it can be misleading. For instance, the probability of winnin...

3135 sym 6 img

The Monty Hall problem

20.07.2014

The Monty Hall problem is a famous game which was played in the television show “Let’s make a deal”.The game goes like this:There are three doors, behind each door there is either a goat or an amazing sportcar. The contestant wins if they guess where the car is. There are in total 2 goats and the car. Therefore the initial chanc...

1788 sym 6 img

Copula functions in R

21.07.2014

A copula function is an application which “couples” (joins) a multivariate distribution to its univariate margins (marginal distributions).Copula functions can be really helpful in building multivariate distributions given the marginals. Here is a fast introduction to copulas.A copula C can be defined as follows:where I is the int...

2176 sym R (791 sym/5 pcs) 20 img

Simulate data with R

23.07.2014

Last semester I was attending a boring class, even though the professor was really clever, he was always bouncing around the main theme and never got straight to the point. While thinking about everything but the class, I had an idea: when you are given a set of data, say X and Y, you can easily compute a linear regression model, e.g....

1537 sym 2 img

Estimating the area under a curve using random points in R

23.07.2014

Even though this post is not the first one on this blog, the code I used to estimate the area under the curve x^2 and posted below is one of my first attempts to code something “complicated” with R. It has been more than 5 months since I wrote it, it does look a bit clunky now. Indeed. However I believe it is fun to keep an eye on...

902 sym 4 img

The maths of Texas Hold ’em with R

24.07.2014

Please before continue reading, make sure to read the disclaimer at the bottom of this article. Every time I watch on tv some game of Texas Hold’em I am always curious about the small percentages which appear in the bottom corners of the screen and tell us the chances of win for each player. There must be some kind of algorithm which implements...

4167 sym 12 img

Stochastic processes and stocks simulation

25.07.2014

Please before continue reading, make sure to read the disclaimer at the bottom of this article. Sometimes names of phenomena do not look like they suit the things they are attached to. In my opinion, that’s the case for stochastic processes.Stochastic process is a fancy word to describe a collection of random variables, which should represent t...

3692 sym 16 img

Calculating VaR with R

27.07.2014

Simulations can be useful in an unimaginably large number of scenarios. Finance in particular is a field of study where maths and statistics have made led to great advances (sometimes for the good, sometimes for the bad). Value at Risk is just another example of subject where a simulation approach could be handy. But, what is VaR? VaR is an indic...

3486 sym 12 img

Plain vanilla BlackJack simulation with R

30.07.2014

Please before continue reading, make sure to read the disclaimer at the bottom of this article. Here is a simulation I run with R in the same period I created the poker one. I have just decided to call it plain vanilla since neither double down or split pairs are allowed. Rules are as basic as they can be. The code looks like messy, I know, If I ...

4378 sym 30 img

Multivariable gradient descent

09.09.2014

This article is a follow up of the following:Gradient descent algorithm Here below you can find the multivariable, (2 variables version) of the gradient descent algorithm. You could easily add more variables. For sake of simplicity and for making it more intuitive I decided to post the 2 variables case. In fact, it would be quite challenging to p...

1581 sym 4 img