How to create presentations in R

There are several possibilities to create a presentation in R. Last versions of RStudio allow us to do it very easily and using a simple syntax with markdown. The result is so clean and elegant, and we can forget to export plots or dataframes to insert in a presentation because RMarkdown does it for us. Yesterday I…

Equinox Spring’17 – Elevator Pitch

Last week was the 4th edition of the programming contest Equinox, a hack day and hack night for the CDO unit (Chema Alonso’s unit) at Telefónica. For the competition you can present anything you want as long as you made it work. So we made a data science team to design an intelligence elevator system in R. Main objective was…

Secret Santa in R

Secret Santa (Amigo Invisible in Spanish) is a Christmas tradition very common all around the world. In a group of friends they are assigned randomly a person to give a gift. The assignation is anonymous and there is a lot of ways to do the raffle. Here I want to show a possibility to do…

Shiny App for Hurricane Matthew Simulation

Shiny is the amazing web application framework for R. Today I want to illustrate an example about how it works and how to change the framework theme, a new shiny option incorporated recently. First, we load all libraries we are going to use. In this case we will plot a map with hurricane Matthew evolution, so…

Satellites Prediction with Logistic Regression Model

In this post we are going to learn how to explore small categorical data and fit a logistic regression model with two predictors. We’ll use the nesting horseshoe crabs dataset from J. Brockmann’s study, Ethology 1996. Each female horseshoe crab had a male crab attached to her in her nest. The study investigated factors that affect…

Twitter Trends Analysis for #26J

Twitter data can be very powerful for trending topic analysis and make predictions about the latest events in the world. In R, we can analyze these trends very easily, with twitteR library. This package allows us download twitter data by hashtag or text providing user, location, date, if retweeted, retweet counts, etc. Here we show an…

Functional Logistic Regression Model

When we have a set of curves observed in a finite set of time points from different sample individuals we are talking about functional data. The FDA, or functional data analysis studies how to reconstruct the true functional form of the data, and creates a basis expansion to achieve it. For another hand, glm models…

Jacknife Estimation

There are many ways of estimate parameters from a sample. Sometimes it’s difficult to calculate variance and bias estimation. Here I want to show one amazing technique which can solve this problem: Jacknife estimation. This method is one of the most common resampling techniques such as boostrap. The parameter of interest is estimated from the subsamples omitting the $i$-th…

Simulating queues

Queueing theory study waiting times in queues. The number of elements or individuals in the system, composed by queue and servers, can be estimated from arrivals and services which are described as mathematical process. In the M/M/k, using Kendall’s notation, arrivals occur according to a Poisson process and the service time is exponentially distributed. Param k describes the…

Web Scraping of a historic race

Jesse Owens was one of the greatest and most famous athletes in history. He won four gold medals in 1936 Olympic Games in Berlin. I’d like to show how explore the results of the 100 meters race where Owens won one of his medals. We’re going to use the library rvest for web scraping and then…

Maps with ggmap

Ggplot2 is a powerful and awesome tool to visualize data and statistical analysis in R. Today I’d like to show you how to plot spatial data over static maps from Google Maps, OpenStreetMap, Stamen Maps, or CloudMade Maps. Ggmap which allows us to visualize any part of the world with a simple code. This function download coordinates with get_map() and then plot the map. qmplot() is…

Linear Contrast

How to do a linear contrast with nonparametric regression In R, we can use  sm.regression()  for apply non parametric regression. We add the option model=”linear”  to do a linear contrast.  The example showed here is about results of mba grade  with 3 variables: gender, gmat and gpa. The objetive is estimate gpa given gmat. We not reject linear hypothesis…