MicroStrategy ONE
The R Integration Pack is no longer supported as of December 2024.
R Script Example
Below is the R script for the forecasting analytic. It is also available as part of the installation package in the default RScripts folder as a file called SeasonalForecasting.R. This example explains how to deploy this script with the MicroStrategy Tutorial project available with MicroStrategy Intelligent Enterprise.
The header block for this R script includes the following metric expression information:
#Metric Expression:
RScript<_RScriptFile="SeasonalForecasting.R",
_InputNames="Target, Trend, Season", StringParam9="">
(Target, Trend, Season)
The inputs for the metric expression are included in parentheses and separated by commas at the end of the metric expression: (Target, Trend, Season).
The following steps provide a brief overview of how to use the metric expression to deploy the example analytics to MicroStrategy Intelligent Enterprise. The metric is placed in a report for analysis.
To Deploy Sample R Analytics
- Copy the metric expression to the clipboard.
-
Open the MicroStrategy Tutorial project in either Developer or Web and run the report named "2 --Monthly Revenue Forecast" located by default at:
CopyTutorial\Public Objects\Reports\MicroStrategy Platform Capabilities\MicroStrategy Data Mining Services\Linear Regression\Monthly.
- When the report finishes executing, insert a new metric and give it a name, such as Forecast from R.
-
Paste the metric expression from the clipboard into the Definition field of the new metric.
The inputs are listed at the end of the metric expression, in parentheses and separated by commas.
- Highlight Target in the expression and replace it with Revenue from the Report Objects.
- Highlight Trend in the expression and replace it with Month Index from the Report Objects.
- Highlight Season in the expression and replace it with Month of Year from the Report Objects.
- Click OK and re-execute your report.
The values for your new metric generated by R match those from the Revenue Predictor (Monthly) metric, because they are both linear regression models trained with the same data as on this report.