Publications by MK
Project Euler: problem 3
The prime factors of 13195 are 5, 7, 13 and 29.What is the largest prime factor of the number 600851475143 ?This one was quite easy, and much easier in R as it turns out.The GNU Multi-Precision Library (GMP) is available as a package in R. So the only thing I had to do is install the library. Rest… well… not much…library(gmp)factorize(60085...
1142 sym 2 img
Project Euler: problem 6
The sum of the squares of the first ten natural numbers is,12 + 22 + … + 102 = 385The square of the sum of the first ten natural numbers is,(1 + 2 + … + 10)2 = 552 = 3025Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 – 385 = 2640.Find the difference between the s...
1956 sym 2 img
Modelling with R: part 1
When I started work about 3 months ago, I didn’t know much more than loading data and executing standard Econometric commands in R. But now I feel much much much more confident in using R for work, for research, for puzzles, and sometimes just for fun. I have learnt a lot of R, statistics, and real world application of Econometrics than I ever ...
5281 sym 2 img
Modelling with R: part 2
I apologize for the delay in the second post (just in case anybody was waiting), I had been vary involved with work the past week. I shall try to be more regular. Well, in the previous post, we successfully imported data into R and got a basic “feel” of it by looking at the various variables present and their types as well. Now we will try to...
7610 sym 2 img
Modelling with R: part 3
The previous posts, part 1 and part 2, detailed the procedure to successfully import the data and transform the data so that we can extract some useful information from them. Now it’s time to get our hands dirty with some predictive modelling.The dependent variable here is a binary variable taking values “0” and “1”, indicating whethe...
6400 sym R (3806 sym/1 pcs)
Modelling with R: part 4
In part 3, we ran a logistic model to determine the probability of default of a customer. We also saw the outputs and tried to judge the performance of the model b plotting the ROC curve. Let’s try a different approach today. How about a decision tree? For starters, we being a simple decision tree with no priors. ###...
4787 sym
Modelling with R: part 5
In our exercise of learning modelling in R, we have till now succeeded in doing the following:Importing the dataPreparing and transforming the dataRunning a logistic regressionCreating a decision treeSpecifically, we created a decision tree using the rpart package. The decision tree was built with no priors and gave an AUC value of 0.73475 as opp...
5285 sym
Create your own Beamer template
For the past couple of days, I had been searching for a tutorial that would show how to create a custom Beamer template. I found some great resources and some really great customized templates (I have listed the ones that I referred to below) but none indicated how should I go about it. There was just lines and lines of code and for someone like ...
14707 sym
Project Euler: Problem 16
215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.What is the sum of the digits of the number 21000?Handling large numbers or rather, very large numbers, can be a pain at times. But have no fear, for GMP is here.GMP makes the solution quite simple.library(gmp)x # as.bigz() is a function in the gmp library that helps dealing with ...
1431 sym
Project Euler: Problem 20
n! means n x (n – 1) x … x 3 x 2 x 1For example, 10! = 10 x 9 x … x 3 x 2 x 1 = 3628800,and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.Find the sum of the digits in the number 100!The approach to this problem is quite similar to problem 16 which we can see here. We just need to deal with a really l...
1235 sym