# Introducing Foretoken

Foretoken is a free data forecasting tool built on Ruby on Rails which takes user-generated historical data to forecast future data points utilizing a simple linear regression model.

For this application I built a Rails authentication system from scratch with the help of bcrypt for password encryption. I utilized AJAX, jQuery, and Bootstrap for a single-page UI, MySQL for

the database, Charts.js for chart rendering, and nested RESTful routes.

###### The App

Foretoken's algorithm is based on a simple linear regression model. In a future blog post, I will write more about converting the equation into a Ruby algorithm.

Here's a walkthrough of the application:

First, create a new project. In my case, I have created one called "Iraq GNI per capita (USD)."

Next, input the data for Historical Period (x), which I have entered as years, and Historical Data (y), which I've entered as GNI or Gross National Income per capita in USD (source: World Bank). The columns and rows in gray simply show the math for the regression model. These fields are uneditable.

In the second table, I have entered the periods that I would like to forecast, in this case the years 2014 through 2016. Click on "Show Results" to display the graph and forecasted data.

Voila! We have our results. The blue line represents the regression model or trend line. The white line represents both the historical and forecasted data.

The table below the graph contains the forecasted periods and their corresponding data points.

###### In Progress

The next step is to complete the integration of a RESTful World Bank API integration, which will make it easier for the end user to analyze extensive mass economic and demographic data.