We have now gathered our data and cleansed/transformed it to suit our modeling needs. The next step is to actually build the model. The goal of predictive modeling is to build a model to predict the future outcomes using statistical techniques. We use well-known statistical methods (algorithms) to find the function (model) that best describes […]

## Credit Modelling: Training and Test Data Sets

For building the model, we will divide our data into two different data sets, namely training and testing datasets. The model will be built using the training set and then we will test it on the testing set to evaluate how our model is performing. There are many ways in which we can split the […]

## German Credit Data : Data Preprocessing and Feature Selection in R

The purpose of preprocessing is to make your raw data suitable for the data science algorithms. For example, we may want to remove the outliers, remove or change imputations (missing values, and so on). The dataset that we have selected does not have any missing data. But, in real time there is possibility that the […]

## Import Credit Data Set in R

We are using the German Credit Scoring Data Set in numeric format which contains information about 21 attributes of 1000 loans. First, setup a working directory and place this data file in that directory. Then, import the data into your R session using the following command: Attribute Details 20 attributes are used in judging a […]

## Case Study – German Credit – Steps to Build a Predictive Model

We will preform various steps in building our predictive model. These steps are explained below: Step 1 – Data Selection The first step is to get the dataset that we will use for building the model. For this case study, we are using the German Credit Scoring Data Set in the numeric format which contains […]

## Classification vs. Regression Models

While building any predictive model, it is important to first understand whether it is a classification or a regression problem. Let’s understand the difference between the two: 1. Classification In a classification problem, we are trying to predict the class of a data point (discreet number of values). The Y variable that we are trying […]

## Credit Risk Modelling – Case Studies

In this tutorial, we will learn credit risk modeling in R using case studies. Specifically, we will use two case studies starting with a simpler one using which we will learn the methodology and important concepts and techniques. Note: As a pre-requisite, it will be helpful to go through this tutorial first – Foundations of […]

## Quantstrat Case Study – Multiple Symbol Portfolio

One of the main advantages of quantstrat package is that we can backtest strategies with multiple symbols as fast as with one symbol. The package provides fast computations for multiple symbols that allow analysts to get insights of strategies in an efficient approach. In this case study we will build a strategy that works with 9 ETFs […]

## Quantstrat Example in R – RSI Strategy

In this Quantstrat case study, we will create a strategy with the Relative Strength Index (RSI) indicator that gives signals related to overbought and oversold regimes. RSI Strategy Entry and Exit Signals In our strategy, we will work with the RSI signal to generate long positions only. We will analyze the strategy with 2 different exit conditions […]

## Quantstrat – EMA Crossover Strategy – Performance and Risk Metrics

Once we have the strategy results, quantstrat provides many functions to analyze the strategy and observe important metrics of performance and risk. We would combine the quantstrat package with the PerformanceAnalytics package to show important performance and risk metrics in a trading strategy. We will look at the following: Plot the Strategy Performance Strategy Statistics and Stats per Trade […]