How to specify a Spotfire regression model with no intercept.

How to specify a Spotfire regression model with no intercept.

book

Article ID: KB0073559

calendar_today

Updated On:

Products Versions
Spotfire Analyst All
Spotfire Enterprise Runtime for R All

Description

How to specify a Spotfire regression model with no intercept.

Issue/Introduction

You can specify a Spotfire linear regression model with no intercept by manually editing the regression formula that is sent to Spotfire's TIBCO Enterprise Runtime for R (TERR) engine for processing.

Environment

All supported environments

Resolution

In the text field named "Formula expression (column names quoted with backticks)" at the bottom of Spotfire's "Tools > Regression Modeling" dialog, you can specify a zero intercept by typing -1 at the end of the formula.

For example, if you have used the dialog's point-and-click options to define the following formula expression:

     `Fuel` ~ `Weight`

you can edit it to read as follows to specify a zero intercept ("no intercept") in the regression model:

     `Fuel` ~ `Weight` - 1

With this change, the resulting model's "Coefficients" component will list a coefficient for the Weight column, but it will not list an intercept because the formula has defined the model's y-intercept to be zero. The regression model is generated using a Spotfire data function that sends the data and a script to TIBCO Spotfire Enterprise Runtime for R (TERR) for processing.  




Important Note:  The syntax for this method uses the number 1, as in the following example:

 `Fuel` ~ `Weight` - 1


It will fail if you try to use a lower-case "l" (that is, the lower-case version of the letter "L"), as in the following example:

 `Fuel` ~ `Weight` - l


If you try to use a lower-case "l", it will look for a TERR object named 'l'.  If there is no such object, it will throw the following error:

-----------
TIBCO Enterprise Runtime for R returned an error

The data function 'MyModel' could not be executed.

Error in eval(attr(formula, "variables"), envir = data, enclos = encl : object 'l' not found

-----------

 

Additional Information

For more information you can open a TERR Console session (by selecting "Tools > TERR Tools > Launch TERR Console" from the Spotfire desktop client's main menu), then issue the following commands to open the relevant TERR help files in a web browser:

     ?lm
     ?formula.object


The following item among the examples in the "formula.object" help file illustrates how this would be done in a TERR console session:

     # no intercept 
     lm(Fuel ~ Weight - 1, data=fuel.frame)