R Scripts "Shelf"

Here you'll find ready-to-go R Analytics which can easily be added to your R-enabled MicroStrategy environment (click Here to learn more about installation and how to deploy R analytics). No R experience is required, if you can create a MicroStrategy metric then you can deploy any of these analytics!

RScriptsSourcing.png

While the R Analytic always executes in your local environment, there are two options for telling MicroStrategy where to find the R Script:

  1. URL-Sourced: The fastest way to get started on systems with internet access is to use the appropriate Metric Expression for URL-Sourced R Scripts.
  2. Local-File: You can also download the R Script and save it to the Centralized RScripts Repository. Once you've downloaded the R Script into the right place, use the appropriate Local-File Metric Expression (also found in the R Script itself).

Once you've copied the metric expression:

  1. Simply paste the Metric Expression into any MicroStrategy metric editor
  2. Match analytic's inputs and function parameters for your application
  3. Name and save the metric so it can be added to any MicroStrategy report, scorecard or dashboard

For details about how a particular analytic works, be sure to check out its Documentation.

R Analytic Metric Expression (Local-File)   [Switch to URL-Sourced]
Seasonal Forecasting

Forecasts seasonal data using the Linear Regression algorithm

R Script
Documentation
Forecast:
RScript<_RScriptFile="SeasonalForecasting.R", _InputNames="Target, Trend, Season", StringParam9="">(Target, Trend, Season)
ARIMA

Forecasts time series data using the ARIMA algorithm (Auto-Regression Integrated with Moving Average)

R Script
Documentation

Forecast
RScript<_RScriptFile="ARIMA.R", _InputNames="Target", SortBy=(Month), NumericParam1=12, NumericParam2=12, NumericParam3=80, NumericParam4=95>(Target)
ForecastLo1
RScript<_RScriptFile="ARIMA.R", _InputNames="Target", [_OutputVar]="ForecastLo1", SortBy=(Month), NumericParam1=12, NumericParam2=12, NumericParam3=80, NumericParam4=95>(Target)
ForecastHi1
RScript<_RScriptFile="ARIMA.R", _InputNames="Target", [_OutputVar]="ForecastHi1", SortBy=(Month), NumericParam1=12, NumericParam2=12, NumericParam3=80, NumericParam4=95>(Target)
ForecastLo2
RScript<_RScriptFile="ARIMA.R", _InputNames="Target", [_OutputVar]="ForecastLo2", SortBy=(Month), NumericParam1=12, NumericParam2=12, NumericParam3=80, NumericParam4=95>(Target)
ForecastHi2
RScript<_RScriptFile="ARIMA.R", _InputNames="Target", [_OutputVar]="ForecastHi2", SortBy=(Month), NumericParam1=12, NumericParam2=12, NumericParam3=80, NumericParam4=95>(Target)
Clustering

Clustering using the k-Mediods algorithm

R Script
Documentation

Cluster
RScript<_RScriptFile="kMedoidsClustering.R", _InputNames="Vars", NumericParam1=4, NumericParam2=10>(Vars)
Medoids
RScript<_RScriptFile="kMedoidsClustering.R", _InputNames="Vars", [_OutputVar]="Medoids", NumericParam1=4, NumericParam2=10>(Vars)
Naive Bayes

Classification using the Naive Bayes algorithm

R Script
Documentation

Class
RScript<_RScriptFile="NaiveBayes.r", _InputNames="Target, Vars", StringParam9="NaiveBayes", BooleanParam9=TRUE, NumericParam1=1>(Target, Vars)
ClassId
RScript<_RScriptFile="NaiveBayes.r", _InputNames="Target, Vars", [_OutputVar]="ClassId", StringParam9="NaiveBayes", BooleanParam9=TRUE, NumericParam1=1>(Target, Vars)
Neural Network

Classification using Neural Networks

R Script
Documentation

Class
RScript<_RScriptFile="NeuralNetwork.r", _InputNames="Target, Vars", _NullsAllowed=False, StringParam9="NeuralNetwork", BooleanParam9=TRUE, NumericParam1=3, NumericParam2=42>(Target, Vars)
ClassId
RScript<_RScriptFile="NeuralNetwork.r", _InputNames="Target, Vars", _NullsAllowed=False, [_OutputVar]="ClassId", StringParam9="NeuralNetwork", BooleanParam9=TRUE, NumericParam1=3, NumericParam2=42>(Target, Vars)
Random Forests

Classification using the Random Forests algorithm

R Script
Documentation

Class
RScript<_RScriptFile="RandomForest.R", _InputNames="Target, Vars", StringParam9="RandomForest", BooleanParam9=TRUE, NumericParam1="750", NumericParam2="3", NumericParam3="42" >(Target, Vars)
ClassId
RScript<_RScriptFile="RandomForest.R", _InputNames="Target, Vars", [_OutputVar]="ClassId", StringParam9="RandomForest", BooleanParam9=TRUE, NumericParam1="750", NumericParam2="3", NumericParam3="42">(Target, Vars)
Pairwise Variable Correlation

Peforms pairwise variable correlations

R Script
Documentation

Result
RScript<_RScriptFile="PairwiseCorr.R", BooleanParam1=TRUE, StringParam8="PairwiseCorr", StringParam9="PairwiseCorr">(Labels, Vars)

Share your scripts:

We'd like to encourage everyone in the community to use and share these R Scripts.  Have you written an R Script you'd like to share with the rest of the community?  That would be great!  

If you have a R Script you'd like to contribute, please email your script and it's documentation to rpechter@microstrategy.com.  We'll test it to confirm its ready for general use by others. Once accepted, we'll add it to this page.

Code Disclaimer:   

This page provides programming examples.  MicroStrategy grants you a nonexclusive copyright license to use all programming code examples from which you can use or generate similar function tailored to your own specific needs.  All sample code is provided for illustrative purposes only. These examples have not been thoroughly tested under all conditions. MicroStrategy, therefore, cannot guarantee or imply reliability, serviceability, or function of these programs.  All programs contained herein are provided to you "AS IS" without any warranties of any kind. The implied warranties of non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed.

Last edited Jun 25, 2014 at 10:48 PM by rpechter, version 1

Comments

No comments yet.