Publications by Mic

Generate slope fields in R and Python

21.09.2014

Here is a short post on how to generate a quick slope field in R and Python. If you do not know what a slope field is, well I am not the best person to explain it to you since it is a relative new concept for me as well. From what I’ve understood on the subject, a slope field is a graphical way to sort out a first-order differential equation an...

1557 sym 12 img

Pearson’s chi-squared test: a simple implementation in R (test of independence)

17.12.2014

Hi everyone! Today I found my old statistics workbooks and start wondering what I could get out of them. Statistics can look pretty boring when using only pen and paper, since many times you’re just making a lot of repetitive calculations. However, the results of those calculations might of course be interesting. Person’s chi-squared test is...

1678 sym 2 img

Gini coefficient, concentration measurement: an implementation in R

17.12.2014

Another subject we took in the statistics class was the Gini index. Gini index or ratio or coefficient is used to calculate how much a certain transferable phenomenon such as income or stocks for instance, is concentrated. For example, say you are evaluating a company and you’d like to know more about how the shares are divided among the share...

1070 sym 6 img

How to fit a copula model in R

10.02.2015

I have been working on this topic for a great amount of time and to be honest I find R documentation not that user-friendly as the documentation for most Python modules. Anyway the fact that copulas are not the easiest model to grasp has contributed to further delays too. But mainly the lack of examples and users of these models was the biggest o...

3597 sym 8 img

Volume of solids of revolution: the cone

06.03.2015

Have you ever wondered where do all those formulas to calculate the volume of solids like a cone, a cylinder, a sphere ecc… come from? In fact they come from a simple formula and from a clever basic idea. Imagine you have a function f Intuitively you could approximate the volume by dividing your interval into a number n of small intervals o...

1959 sym 10 img

Hypothesis testing on normally distributed data in R

11.07.2015

Hypothesis testing is a useful statistical tool that can be used to draw a conclusion about the population from a sample. Say for instance that you are interested in knowing if the average value of a certain parameter differs significantly from a given value within a well defined confidence level: you would probably set up your test like this: N...

3443 sym 10 img

How to make a rough check to see if your data is normally distributed

11.07.2015

Now then, in the previous article I wrote about hypothesis testing with data that is normally distributed, in this article I’m going to post some quick test you can do to check if it is fairly safe to assume your data is normal. I would like to highlight the fact that you can never be 100% sure that your data follows a particular distribution, ...

3614 sym 10 img

Estimating data parameters using R

11.07.2015

Say we have some data and we are pretty confident that it comes from a random variable which follows a Normal distribution, now we would like to estimate the parameters of that distribution. Since the best estimator for the population mean is the sample mean and the best estimator for the variance is the corrected variance estimator, we could use...

1721 sym 10 img

Estimating arrival times of people in a shop using R

30.07.2015

Since the first time I was taught the Poisson and Exponential distributions I have been wondering how to apply them to model a real world scenario such as arrivals of people in a shop. Last week I was in a big shopping center and I thought that was the perfect time to gather some data so I chose a shop (randomly) and started recording on a piece ...

4272 sym 16 img

Simple regression models in R

01.08.2015

Linear regression models are one the simplest and yet a very powerful models you can use in R to fit observed data and try to predict quantitative phenomena. Say you know that a certain variable y is somewhat correlated with a certain variable x and you can reasonably get an idea of what y would be given x. A class example is the price of houses...

4419 sym 12 img